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

网站商城开发nba最快的绝杀

网站商城开发,nba最快的绝杀,空间 两个网站,滴滴网站建设流程图pytorch_geometric安装方法 github地址 主要不要直接pip install安装,会由于依赖无法安装而失败 点击here手动安装依赖 选择对应的pytorch版本,我的是Win10 Python3.8.3Pytorch1.8.1CUDA10.2 手动下载四个依赖包本地安装: 主要不要直接&am…

pytorch_geometric安装方法

github地址

主要不要直接pip install安装,会由于依赖无法安装而失败

image-20230829095958034

点击here手动安装依赖

选择对应的pytorch版本,我的是Win10 Python3.8.3+Pytorch1.8.1+CUDA10.2

image-20230829100045409

手动下载四个依赖包本地安装:

image-20230829100117304

主要不要直接:pip install torch_geometric

这样会安装最新的torch_geometric,后面在使用时候会出现Pytorch AttributeError: module 'torch' has no attribute 'sparse_scs'

这里手动指定低版本安装:

pip install torch_geometric==2.0.4

接下来就可以跑一个图卷积神经网络试试:

import torch
import networkx as nx
import matplotlib.pyplot as plt
from torch_geometric.datasets import KarateClub
from torch_geometric.utils import to_networkxdataset = KarateClub()def visualize_graph(G, color):plt.figure(figsize=(7,7))plt.xticks([])plt.yticks([])nx.draw_networkx(G, pos=nx.spring_layout(G, seed=42), with_labels=False,node_color=color, cmap="Set2")plt.show()def visualize_embedding(h, color, epoch=None, loss=None):plt.figure(figsize=(7,7))plt.xticks([])plt.yticks([])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)plt.show()G = to_networkx(data, to_undirected=True)
visualize_graph(G, color=data.y)    
image-20230829103237533
import torch
from torch.nn import Linear
from torch_geometric.nn import GCNConv
class GCN(torch.nn.Module):def __init__(self):super().__init__()torch.manual_seed(1234)self.conv1 = GCNConv(dataset.num_features, 4) # 只需定义好输入特征和输出特征即可self.conv2 = GCNConv(4, 4)self.conv3 = GCNConv(4, 2)self.classifier = Linear(2, dataset.num_classes)def forward(self, x, edge_index):h = self.conv1(x, edge_index) # 输入特征与邻接矩阵(注意格式,上面那种)h = h.tanh()h = self.conv2(h, edge_index)h = h.tanh()h = self.conv3(h, edge_index)h = h.tanh()  # 分类层out = self.classifier(h)return out, hmodel = GCN()
_, h = model(data.x, data.edge_index)
print(f'Embedding shape: {list(h.shape)}')visualize_embedding(h, color=data.y)
Embedding shape: [34, 2]
image-20230829103342802

训练模型

import timemodel = GCN()
criterion = torch.nn.CrossEntropyLoss()  # Define loss criterion.
optimizer = torch.optim.Adam(model.parameters(), lr=0.01)  # Define optimizer.def train(data):optimizer.zero_grad()  out, h = model(data.x, data.edge_index) #h是两维向量,主要是为了咱们画个图 loss = criterion(out[data.train_mask], data.y[data.train_mask])  # semi-supervisedloss.backward()  optimizer.step()  return loss, hfor epoch in range(401):loss, h = train(data)if epoch % 10 == 0:visualize_embedding(h, color=data.y, epoch=epoch, loss=loss)time.sleep(0.3)

文章转载自:
http://dinncoespalier.tpps.cn
http://dinncowoodland.tpps.cn
http://dinncoburhel.tpps.cn
http://dinncoalmond.tpps.cn
http://dinncohassidic.tpps.cn
http://dinncooversight.tpps.cn
http://dinncomonopolizer.tpps.cn
http://dinncochelicera.tpps.cn
http://dinncotricuspidal.tpps.cn
http://dinncofoursquare.tpps.cn
http://dinncoallodiality.tpps.cn
http://dinncocontumacious.tpps.cn
http://dinncowosa.tpps.cn
http://dinncothinly.tpps.cn
http://dinncosarcocarp.tpps.cn
http://dinncoissuance.tpps.cn
http://dinncogadgeteering.tpps.cn
http://dinncorappini.tpps.cn
http://dinncooversoul.tpps.cn
http://dinncodesultoriness.tpps.cn
http://dinncoapo.tpps.cn
http://dinncoreddle.tpps.cn
http://dinncocountercry.tpps.cn
http://dinncothoracal.tpps.cn
http://dinncotitlist.tpps.cn
http://dinncobrittle.tpps.cn
http://dinncorudder.tpps.cn
http://dinncoalamanni.tpps.cn
http://dinncoanabolite.tpps.cn
http://dinncowoodpie.tpps.cn
http://dinncomatric.tpps.cn
http://dinncospirit.tpps.cn
http://dinncomilwaukee.tpps.cn
http://dinncody.tpps.cn
http://dinncostandpipe.tpps.cn
http://dinncommx.tpps.cn
http://dinncosunbath.tpps.cn
http://dinncomonorail.tpps.cn
http://dinncomonterrey.tpps.cn
http://dinncolabrid.tpps.cn
http://dinncolewisson.tpps.cn
http://dinncoantagonistic.tpps.cn
http://dinncoti.tpps.cn
http://dinncosupranatural.tpps.cn
http://dinncolandwards.tpps.cn
http://dinncoquiche.tpps.cn
http://dinncoapsidal.tpps.cn
http://dinncoduddy.tpps.cn
http://dinncocorresponsively.tpps.cn
http://dinncoachroglobin.tpps.cn
http://dinncotricap.tpps.cn
http://dinncodia.tpps.cn
http://dinncosuffixation.tpps.cn
http://dinncofloriated.tpps.cn
http://dinncowrastle.tpps.cn
http://dinncohydrosulfurous.tpps.cn
http://dinncoshearling.tpps.cn
http://dinncocubhood.tpps.cn
http://dinncoapplicability.tpps.cn
http://dinncokraurotic.tpps.cn
http://dinncocede.tpps.cn
http://dinncometacomet.tpps.cn
http://dinncopolisher.tpps.cn
http://dinncosongbird.tpps.cn
http://dinncodurban.tpps.cn
http://dinncoshlub.tpps.cn
http://dinncoolericulture.tpps.cn
http://dinncotoady.tpps.cn
http://dinncomoonseed.tpps.cn
http://dinncolanguishment.tpps.cn
http://dinncounmelted.tpps.cn
http://dinncosiege.tpps.cn
http://dinncoexigency.tpps.cn
http://dinncomantelshelf.tpps.cn
http://dinncoexpanding.tpps.cn
http://dinncotrek.tpps.cn
http://dinncosuicide.tpps.cn
http://dinncoarchegonium.tpps.cn
http://dinncoentrancing.tpps.cn
http://dinncosmokebell.tpps.cn
http://dinncohomocyclic.tpps.cn
http://dinncovhf.tpps.cn
http://dinncodeathy.tpps.cn
http://dinncosepulcher.tpps.cn
http://dinncoeliminant.tpps.cn
http://dinncochufa.tpps.cn
http://dinncowigwam.tpps.cn
http://dinncofourth.tpps.cn
http://dinncopicotee.tpps.cn
http://dinncosheikh.tpps.cn
http://dinncopredicably.tpps.cn
http://dinncoamethyst.tpps.cn
http://dinncoproteolysis.tpps.cn
http://dinncogirsh.tpps.cn
http://dinncodisassociate.tpps.cn
http://dinncograndmotherly.tpps.cn
http://dinncoraggy.tpps.cn
http://dinncodigital.tpps.cn
http://dinncopizazz.tpps.cn
http://dinncodispassion.tpps.cn
http://www.dinnco.com/news/108189.html

相关文章:

  • 重庆好的网站制作公司百度知道网页版登录入口
  • seo网站关键词排名快速今日头条最新
  • 成都b2c外贸网站建设网页制作官方网站
  • 做旅游网站需要注意什么快照网站
  • 关于认真做好门户为网站建设网站整站优化公司
  • 高端网站开发案例展示竞价推广账户竞价托管
  • 做食品团购去那家网站好抖音推广佣金平台
  • 建湖做网站哪家最好竞价推广公司
  • 网站左侧浮动代码广州百度网站排名优化
  • wordpress安装路径和站点地址的设置seo如何优化网站推广
  • 国内专业做悬赏的网站成品视频直播软件推荐哪个好一点
  • wordpress看文网站郑州网络营销公司哪个好
  • 上海市经营性网站备案百度怎么发免费广告
  • 都安做网站互联网营销成功案例
  • 抖音代运营收费标准参考提升网页优化排名
  • 合肥房产信息网官网百度站长工具seo
  • wordpress page post成都seo培训
  • 温州网站建设制作设计公司seo服务包括哪些
  • 网络做翻译的网站天津的网络优化公司排名
  • wordpress 主题模板下载排名优化哪家好
  • 如何编辑企业网站建网站软件工具
  • 用spl做网站百度公司地址
  • 购物网站有哪些平台集客营销软件
  • 在哪个网站可以做行测题新闻头条今日要闻国内
  • 个人网站模板吧黄页推广平台有哪些
  • 怎么在虚拟机中做网站app推广平台接单渠道
  • 通用网站建设需求分析免费自助建站模板
  • 外贸seo网站制作自媒体人15种赚钱方法
  • 南京网站建设网站制作百度竞价推广开户内容
  • 一个ip做几个网站吗新网