当前位置: 首页 > news >正文

做家装施工的网站必应搜索引擎入口

做家装施工的网站,必应搜索引擎入口,外包小程序开发的价格,商城网站前端更新商品天天做吗PyG (PyTorch Geometric) 是建立在 PyTorch 基础上的一个库,用于轻松编写和训练图形神经网络 (GNN),适用于与结构化数据相关的各种应用。官方文档 Install PyG PyG适用于python3.8-3.12 一般使用场景:pip install torch_geometric 或conda …

PyG (PyTorch Geometric) 是建立在 PyTorch 基础上的一个库,用于轻松编写和训练图形神经网络 (GNN),适用于与结构化数据相关的各种应用。官方文档

Install PyG

PyG适用于python3.8-3.12
一般使用场景:pip install torch_geometricconda install pyg -c pyg

Get Started

PyG 具有以下主要功能:

  • Data Handling of Graphs
  • Common Benchmark Datasets
  • Mini-batches
  • Data Transforms
  • Learning Methods on Graphs
  • Exercises

Data Handling of Graphs

PyG 中的单个图由 torch_geometric.data.Data 的一个实例描述,默认情况下该实例拥有以下属性:

  • data.x: Node feature matrix with shape [num_nodes, num_node_features]
  • data.edge_index: Graph connectivity in COO format with shape [2, num_edges] and type torch.long
  • data.edge_attr: Edge feature matrix with shape [num_edges, num_edge_features]
  • data.y: Target to train against (may have arbitrary shape), e.g., node-level targets of shape [num_nodes, *] or graph-level targets of shape [1, *]
  • data.pos: Node position matrix with shape [num_nodes, num_dimensions]

Colab Notebooks and Video Tutorials

官方文档
Pytroch Geometric Tutorials

Tutorials 1

理解一个节点出发的计算图,理解多次计算图后可能节点信息就包含整个图数据信息了,反而没有用。
对应whl地址

安装torch版本对应的pyg,如下所示:

import os
import torch
os.environ['TORCH'] = torch.__version__
print(torch.__version__)!pip install -q torch-scatter -f https://data.pyg.org/whl/torch-${TORCH}.html
!pip install -q torch-sparse -f https://data.pyg.org/whl/torch-${TORCH}.html
!pip install -q git+https://github.com/pyg-team/pytorch_geometric.git

可视化网络的函数实现

# 可视化函数
%matplotlib inline
import torch
import networkx as nx
import matplotlib.pyplot as plt# visualization function for NX graph or Pytorch tensor
def visualize(h, color, epoch=None, loss=None):plt.figure(figsize=(7,7))plt.xticks([])plt.yticks([])if torch.is_tensor(h):# 可视化神经网络运行中间结果h = h.detach().cpu().numpy()plt.scatter(h[:, 0], h[:, 1], s=140, c=color, cmap="Set2")if epoch is not None and loss is not None:plt.xlabel(f'Epoch:{epoch}, Loss:{loss.item():.4f}', fontsize=16)else:nx.draw_networkx(G, pos=nx.spring_layout(G, seed=42), with_labels=False, node_color=color, cmap="Set2")plt.show()

例如:

from torch_geometric.utils import to_networkxG = to_networkx(data, to_undirected=True)
visualize(G, color=data.y)

如图所示:
在这里插入图片描述

参考:

PyTorch Geometric (PyG) 入门教程

http://www.dt0577.cn/news/55760.html

相关文章:

  • 做视频网站可行吗网站建设的方法有哪些
  • 广东网站建设方便附近广告公司
  • 腾讯云服务器用户名网站优化网站优化
  • 北斗手表官方网站千锋教育课程
  • 企业类网站模板免费下载清远seo
  • 互联网营销师是干什么的百度问答seo
  • 网站运营怎样做seo服务靠谱吗
  • 北京天津网站建设哪家公司好semiconductor
  • 网站开发论坛足球积分排行榜最新
  • 网站开发需要服务器吗免费注册二级域名的网站
  • 南宁品牌网站设计公司在线超级外链工具
  • 深圳极速网站建设公司百度商家入驻怎么做
  • 没有影视许可怎么用国内空间做网站网站建设与管理就业前景
  • 郑州本地做团购的网站seo网站是什么意思
  • 斗蟋蟀网站建设营销软文范例500
  • 怎么登录wordpress东莞网站优化
  • 深圳有哪些做网站的公司好百度人工优化
  • 邯郸wap网站建设公司百度网盘网址
  • 淘宝网站怎么做特价网站建设是干什么的
  • 网站 做百度推广有没有效果怎么样适合seo的网站
  • 长沙做网站哪里好刷赞网站推广永久
  • 百度收录网站电话关键词优化公司如何选择
  • 企业型网站建设费用如何制作一个自己的网站
  • 在天津做网站的公司网站标题算关键词优化吗
  • 网站备案时间查询竞价网络推广培训
  • 西安搬家公司哪家好如何进行搜索引擎的优化
  • 软件论坛网站有哪些利尔化学股票
  • 用wordpress复制一个网站模板东莞seo外包公司哪家好
  • 门户网站建设意义站长工具ip地址查询域名
  • 西藏林芝建设厅官方网站热点军事新闻