clcarwin / convert_torch_to_pytorch

Convert torch t7 model to pytorch model and source.
MIT License
540 stars 161 forks source link

Error :Not Implement nn.SpatialUpSamplingBilinear #28

Open XunShape opened 6 years ago

XunShape commented 6 years ago

hi, I wanna convert vrn-unguided.t7 in https://github.com/AaronJackson/vrn and it said :Not Implement nn.SpatialUpSamplingBilinear actually,i got vrn_unguided.pth and vrn_unguided.py but a part of vrn_unguided.py was wrong, like this: LambdaReduce(lambda x,y: x+y), # CAddTable, LambdaMap(lambda x: x, # ConcatTable, nn.Sequential( # Sequential, nn.Sequential( # Sequential, nn.Conv2d(256,256,(1, 1)), nn.BatchNorm2d(256), nn.ReLU(), ), nn.Conv2d(256,200,(1, 1)),

,

         ,
        n,
        n,
        .,
        S,
        p,
        a,
        t,
        i,
        a,
        l,
        U,
        p,
        S,
        a,
        m,
        p,
        l,
        i,
        n,
        g,
        B,
        i,
        l,
        i,
        n,
        e,
        a,
        r,
         ,
        N,
        o,
        t,
         ,
        I,
        m,
        p,
        l,
        e,
        m,
        e,
        n,
        t,
        ,,

,

crazySyaoran commented 6 years ago

Have the same problem, also the vrn code. Have you solved?

alexandru-dinu commented 5 years ago

You have to replace

else:
    s += '# ' + name + ' Not Implemented,\n'

with

else:
    s += ['# ' + name + ' Not Implemented,\n']

Notice the brackets. That's because of map(lambda x: '\t{}'.format(x), s); that function must be mapped onto each sublist from s.

Also, this line must be changed in order to avoiding adding a stray ,.

One very quick fix is:

s = map(lambda x: '{},\n'.format(x) if not x.strip()[0] == '#' else '{}'.format(x), s)
Goulustis commented 3 years ago

could try to go to the generated .py file and replace it with nn.Upsample