摘要: 1 import torch 2 import torch.utils.data as Data 3 import torch.nn.functional as F 4 import matplotlib.pyplot as plt 5 import torch.optim 6 # torch.manual_seed(1) # reproducible 7 8 LR = ... 阅读全文
posted @ 2019-10-26 15:00 _Meditation 阅读(198) 评论(0) 推荐(0) 编辑
摘要: 1 import torch 2 import torch.utils.data as Data 3 4 torch.manual_seed(1) # reproducible 5 6 BATCH_SIZE = 5 7 # BATCH_SIZE = 8 8 9 x = torch.linspace(1, 10, 10) # this is x data ... 阅读全文
posted @ 2019-10-26 14:05 _Meditation 阅读(917) 评论(0) 推荐(0) 编辑
摘要: 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... 阅读全文
posted @ 2019-10-26 13:57 _Meditation 阅读(324) 评论(0) 推荐(0) 编辑
摘要: 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... 阅读全文
posted @ 2019-10-26 13:56 _Meditation 阅读(171) 评论(0) 推荐(0) 编辑
摘要: 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... 阅读全文
posted @ 2019-10-26 13:48 _Meditation 阅读(318) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2019-10-26 13:33 _Meditation 阅读(349) 评论(0) 推荐(0) 编辑
摘要: 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, 阅读全文
posted @ 2019-10-26 13:24 _Meditation 阅读(354) 评论(0) 推荐(0) 编辑
摘要: 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 # 阅读全文
posted @ 2019-10-26 13:13 _Meditation 阅读(765) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2019-10-26 13:12 _Meditation 阅读(279) 评论(0) 推荐(0) 编辑