摘要:
Example:稀疏矩阵乘法 import math import torch import torch.nn.functional as F from torch.nn.parameter import Parameter from torch.nn.modules.module import M 阅读全文
摘要:
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 阅读全文
摘要:
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( 阅读全文
摘要:
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 阅读全文