摘要:
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
别关注我了,私信我吧
阅读(220)
评论(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
别关注我了,私信我吧
阅读(1233)
评论(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
别关注我了,私信我吧
阅读(328)
评论(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
别关注我了,私信我吧
阅读(445)
评论(0)
推荐(0)

浙公网安备 33010602011771号