摘要: Example:稀疏矩阵乘法 import math import torch import torch.nn.functional as F from torch.nn.parameter import Parameter from torch.nn.modules.module import M 阅读全文
posted @ 2022-03-15 20:01 图神经网络 阅读(177) 评论(0) 推荐(1) 编辑
摘要: Example: import torch indices = torch.tensor([[0,1], [0,1]]) values = torch.tensor([2,3]) shape = torch.Size((2,2)) s = torch.sparse.FloatTensor(indic 阅读全文
posted @ 2022-03-15 19:45 图神经网络 阅读(1073) 评论(0) 推荐(0) 编辑
摘要: Example import torch import torch.nn as nn # 判断模型是在CPU还是GPU上 model = nn.LSTM(input_size=10, hidden_size=4, num_layers=1, batch_first=True) print(next( 阅读全文
posted @ 2022-03-15 16:51 图神经网络 阅读(230) 评论(0) 推荐(0) 编辑
摘要: Example: import scipy.sparse as sp import numpy as np import torch adj_matrix = torch.randint(0,2,(4,4)) print(adj_matrix) tensor([[1, 1, 0, 0], [0, 1 阅读全文
posted @ 2022-03-15 16:11 图神经网络 阅读(375) 评论(0) 推荐(0) 编辑
Live2D