当前位置:网站首页>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()
边栏推荐
- 李迟2022年6月工作生活总结
- 基于C语言的菜鸟驿站管理系统
- 一、C语言入门基础
- Weima, which is going to be listed, still can't give Baidu confidence
- Scala基础教程--12--读写数据
- Detailed explanation of the maturity classification of ITSS operation and maintenance capability | one article clarifies the ITSS certificate
- 一种将Tree-LSTM的强化学习用于连接顺序选择的方法
- Neglected problem: test environment configuration management
- 删除二叉搜索树中的节点附图详解
- 力扣刷题日记/day4/6.26
猜你喜欢
ThreadLocal原理与使用
力扣刷题日记/day7/2022.6.29
中国农科院基因组所汪鸿儒课题组诚邀加入
机器学习概念漂移检测方法(Aporia)
Wanghongru research group of Institute of genomics, Chinese Academy of Agricultural Sciences is cordially invited to join
With the stock price plummeting and the market value shrinking, Naixue launched a virtual stock, which was deeply in dispute
TorchDrug教程
Microservice architecture debate between radical technologists vs Project conservatives
My colleagues quietly told me that flying Book notification can still play like this
I wrote a learning and practice tutorial for beginners!
随机推荐
How to open an account is safe,
Installation and use of VMware Tools and open VM tools: solve the problems of incomplete screen and unable to transfer files of virtual machines
蓝桥:合根植物
2022 ByteDance daily practice experience (Tiktok)
Scala基础教程--13--函数进阶
Unity 制作旋转门 推拉门 柜门 抽屉 点击自动开门效果 开关门自动播放音效 (附带编辑器扩展代码)
Li Kou brush question diary /day7/6.30
字节跳动Dev Better技术沙龙成功举办,携手华泰分享Web研发效能提升经验
.NET ORM框架HiSql实战-第二章-使用Hisql实现菜单管理(增删改查)
Detailed explanation of the maturity classification of ITSS operation and maintenance capability | one article clarifies the ITSS certificate
【209】go语言的学习思想
What if the self incrementing ID of online MySQL is exhausted?
[HCIA continuous update] network management and operation and maintenance
SIGMOD’22 HiEngine论文解读
Redis主从复制
PB的扩展DLL开发(超级篇)(七)
Scala基础教程--19--Actor
Once the "king of color TV", he sold pork before delisting
力扣刷题日记/day2/2022.6.24
删除二叉搜索树中的节点附图详解