博客专栏  >  综合   >  PyTorch学习笔记

PyTorch学习笔记

PyTorch学习笔记

关注
1 已关注
14篇博文
  • pytorch 重复采样 与 非重复采样

    import torch import torch.nn.functional as F from torch.autograd import * a = Variable(torch.FloatT...

    2018-01-15 17:20
    30
  • pytorch tensor 转 variable

    import torch from torch.autograd import Variable t = torch.zeros([2,2]) v = Variable(t) print(t) pri...

    2018-01-10 17:03
    74
  • pytorch的tf.slice

    import torch A_idx = torch.LongTensor([0, 2]) # the index vector B = torch.LongTensor([[1, 2, 3], [4...

    2018-01-10 14:26
    65
  • pytorch的reinforce算法 官方文档

    http://pytorch.org/docs/0.3.0/distributions.html probs = policy_network(state) m = Categorical(pr...

    2018-01-05 11:16
    125
  • PyTorch torch.bmm 实例

    >>> batch1 = torch.randn(10, 3, 4) >>> batch2 = torch.randn(10, 4, 5) >>> res = torch.bmm(batch1, ba...

    2017-12-04 11:06
    286
  • PyTorch torch.stack实例

    不是concat的意思import torch a = torch.ones([1,2]) b=torch.ones([1,2]) torch.stack([a,b],1) (0 ,.,.) = ...

    2017-12-05 11:01
    83
  • PyTorch的concat也就是torch.cat实例

    import torch a = torch.ones([1,2]) b = torch.ones([1,2]) torch.cat([a,b],1) 1 1 1 1 [torch.Float...

    2017-12-05 11:14
    126
  • PyTorch的dropout设置训练和测试模式

    class Net(nn.Module): … model = Net() …model.train() # 把module设成训练模式,对Dropout和BatchNorm有影响model.e...

    2017-12-05 20:40
    136
  • PyTorch contiguous 的概念

    x = torch.Tensor(2,3) y = x.permute(1,0) y.view(-1) # 报错,因为x和y指针指向相同 y = x.permute(1,0).contiguous()...

    2017-12-06 14:05
    193
  • pytorch 加正则化的方法

    https://stackoverflow.com/questions/42704283/adding-l1-l2-regularization-in-pytorch

    2017-12-11 10:04
    219
  • pytorch的tf.transpose

    permute>>> img_nhwc = torch.randn(10, 480, 640, 3) >>> img_nhwc.size() torch.Size([10, 480, 640, 3])...

    2017-12-18 12:56
    113
  • pytorch的tf.reshape

    view>>> import torch >>> a = torch.randn(10, 480, 640, 3) >>> b=a.view([480,10,640,3]) >>> b.size()(...

    2017-12-20 11:07
    90
  • pytorch pack_padded_sequence 实例

    import torch import numpy as npinput = torch.from_numpy(np.array([[1,2,3,4],[5,6,7,8],[9,10,11,12]])...

    2017-12-21 14:51
    216
  • pytorch multinomial 实例

    就是抽样 a = torch.FloatTensor([[0,0,0,0,0,0,0,100]]) b=softmax(a) b.multinomial() Variable containi...

    2017-12-31 20:07
    102

img博客搬家
img撰写博客
img发布 Chat
img专家申请
img意见反馈
img返回顶部