What is reshape layer in pytorch?
In torch7 it seems to be nn.View, but what it is in pytorch? What I want is to add a reshpe layer in nn.Sequential. Thanks.
melody-rain
apaszke
Hi, good example. Thanks. Thank you.
melody-rain
apaszke
ypxie
smth
ypxie
<SCODE>import torch.nn as nn

class Reshape(nn.Module):
    def __init__(self, *args):
        super(Reshape, self).__init__()
        self.shape = args

    def forward(self, x):
        return x.view(self.shape)
<ECODE>
allenye0119
Thanks~ but it is still so many codes, a lambda layer like the one used in keras would be very helpful.
ypxie
smth
Shisho_Sama
I have to ask why reshaping does not count as “trivial”? Current way of work forces me to separate logic of data flow to two separate places - definition of the nn.Sequential, and forward()
Noam_Salomonski
For high level DL, those layers are more confusing than beneficial…
dsantiago
alexp