当前位置:网站首页>Torchdrug tutorial
Torchdrug tutorial
2022-07-04 18:53:00 【Stunned flounder (】
TorchDrug
Tensor based graph
Chart
The picture is TorchDrug The basic data structure used in . They can be regarded as graphic processing libraries in the tensor framework ( for example NetworkX) Generalization , At the same time enjoy GPU Acceleration and automatic differentiation .
import torchdrug as td
from torchdrug import data
edge_list = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 0]]
graph = data.Graph(edge_list, num_node=6)
graph.visualize()

molecular
A specific example of the graph in drug discovery is a molecule , It may have additional chemical constraints and characteristics . for example , We can SMILES String constructs a molecule .SMILES Is a language that uses linear strings to describe complex molecular structures .
mol = data.Molecule.from_smiles("C1=CC=CC=C1")
mol.visualize()
print(mol.node_feature.shape)
print(mol.edge_feature.shape)

Figure operation
A group of arbitrary graphs can also be processed in batch , To maximize the use of hardware . They can also be used cpu() and cuda() Method in CPU and GPU Transferred between .
smiles_list = ["CCSCCSP(=S)(OC)OC", "CCOC(=O)N",
"N(Nc1ccccc1)c2ccccc2", "NC(=O)c1cccnc1"]
mols = data.PackedMolecule.from_smiles(smiles_list)
mols.visualize()
mols = mols.cuda()
print(mols)

It's like the original PyTorch Tensors are the same , Graph supports a wide range of indexing operations . Typical uses include application node masking 、 Edge shielding or graphic shielding . The following example shows how to select an edge that contains at least one carbon . See notes for more graphic operations .
node_in, node_out, bond_type = mols.edge_list.t()
edge_mask = (mols.atom_type[node_in] == td.CARBON) | \
(mols.atom_type[node_out] == td.CARBON)
mols = mols.edge_mask(edge_mask)
mols.visualize()

边栏推荐
- . Net ORM framework hisql practice - Chapter 2 - using hisql to realize menu management (add, delete, modify and check)
- Nature Microbiology | 可感染阿斯加德古菌的六种深海沉积物中的病毒基因组
- TorchDrug教程
- mysql5.7安装教程图文详解
- 2022年全国CMMI认证补贴政策|昌旭咨询
- 一、C语言入门基础
- File processing examples of fopen, FREAD, fwrite, fseek
- Interview summary of large factory Daquan II
- ThreadLocal原理与使用
- 6.26CF模拟赛B:数组缩减题解
猜你喜欢

Crawler (6) - Web page data parsing (2) | the use of beautifulsoup4 in Crawlers
![[mathematical modeling of graduate students in Jiangxi Province in 2022] analysis and code implementation of haze removal by nucleation of water vapor supersaturation](/img/da/d46cca19f34223d29003be2e33aaa4.png)
[mathematical modeling of graduate students in Jiangxi Province in 2022] analysis and code implementation of haze removal by nucleation of water vapor supersaturation

Uni app and uviewui realize the imitation of Xiaomi mall app (with source code)

基于unity的愤怒的小鸟设计

中国农科院基因组所汪鸿儒课题组诚邀加入

【2022年江西省研究生数学建模】冰壶运动 思路分析及代码实现

Thawte通配符SSL证书提供的类型有哪些

Halcon template matching
![[go ~ 0 to 1] read, write and create files on the sixth day](/img/cb/b6785ad7d7c7df786f718892a0c058.png)
[go ~ 0 to 1] read, write and create files on the sixth day

ISO27001 certification process and 2022 subsidy policy summary
随机推荐
Is it safe to open an account online? is that true?
Is it safe to download the mobile version of Anxin securities and open an account online
学习路之PHP--phpstudy创建项目时“hosts文件不存在或被阻止打开”
Interview summary of large factory Daquan II
【OpenCV入门到精通之九】OpenCV之视频截取、图片与视频互转
The controversial line of energy replenishment: will fast charging lead to reunification?
基于lex和yacc的词法分析器+语法分析器
MXNet对GoogLeNet的实现(并行连结网络)
2022 national CMMI certification subsidy policy | Changxu consulting
【机器学习的数学基础】(一)线性代数(Linear Algebra)(上+)
Wireshark抓包TLS协议栏显示版本不一致问题
[mathematical modeling of graduate students in Jiangxi Province in 2022] analysis and code implementation of haze removal by nucleation of water vapor supersaturation
PB的扩展DLL开发(超级篇)(七)
Li Kou brush question diary /day5/2022.6.27
Is it science or metaphysics to rename a listed company?
大厂面试总结大全二
TCP waves twice, have you seen it? What about four handshakes?
TorchDrug教程
Scala基础教程--16--泛型
Deleting nodes in binary search tree