xxradon / PytorchToCaffe

Pytorch model to caffe model, supported pytorch 0.3, 0.3.1, 0.4, 0.4.1 ,1.0 , 1.0.1 , 1.2 ,1.3 .notice that only pytorch 1.1 have some bugs
MIT License
782 stars 224 forks source link

in pytorch_to_caffe.py, why some variable operations do not have `log.cnet.add_layer` #82

Open yaoqi-zd opened 4 years ago

yaoqi-zd commented 4 years ago

In pytorch_to_caffe.py, why some variable operations do not have log.cnet.add_layer? like the following code:

#Permute layer. permute layer has log.cnet.add_layer()
def _permute(input, *args):
    x = raw__permute__(input, *args)
    name = log.add_layer(name='permute')
    log.add_blobs([x], name='permute_blob')
    layer = caffe_net.Layer_param(name=name, type='Permute',
                                  bottom=[log.blobs(input)], top=[log.blobs(x)])
    order1 = args[0]
    order2 = args[1]
    order3 = args[2]
    order4 = args[3]

    layer.permute_param(order1, order2, order3, order4)
    log.cnet.add_layer(layer)
    return x

#pow. pow layer doesn't have log.cnet.add_layer()
def _pow(input, *args):
    x = raw__pow__(input, *args)
    log.add_blobs([x], name='pow_blob')
    return x

so when my network has such operations, I cannot find the corresponding layers in caffe prototxt.