摘要:
1 import torch 2 import matplotlib.pyplot as plt 3 4 # torch.manual_seed(1) # reproducible 5 6 # fake data 7 x = torch.unsqueeze(torch.linspace(-1, 1, 100), dim=1) # x data (tensor), sha... 阅读全文
摘要:
1 import torch 2 import torch.nn.functional as F 3 4 5 # replace following class code with an easy sequential network 6 class Net(torch.nn.Module): 7 def __init__(self, n_feature, n_hidd... 阅读全文
摘要:
1 import torch 2 import torch.nn.functional as F 3 import matplotlib.pyplot as plt 4 5 # torch.manual_seed(1) # reproducible 6 7 # make fake data 8 n_data = torch.ones(100, 2) 9 x0 = to... 阅读全文
摘要:
1 import torch 2 import torch.nn.functional as F 3 import matplotlib.pyplot as plt 4 5 # torch.manual_seed(1) # reproducible 6 7 x = torch.unsqueeze(torch.linspace(-1, 1, 100), dim=1) # x data (tensor 阅读全文
摘要:
1 import torch 2 import torch.nn.functional as F 3 from torch.autograd import Variable 4 import matplotlib.pyplot as plt 5 6 # fake data 7 x = torch.linspace(-5, 5, 200) # x data (tensor), shape=(100, 阅读全文
摘要:
1 import torch 2 from torch.autograd import Variable 3 4 # Variable in torch is to build a computational graph, 5 # but this graph is dynamic compared with a static graph in Tensorflow or Theano. 6 # 阅读全文
摘要:
1 import torch 2 import numpy as np 3 4 # details about math operation in torch can be found in: http://pytorch.org/docs/torch.html#math-operations 5 阅读全文