Neural network 如何为带有两个顶部blob的caffe python层编写向后函数?

Neural network 如何为带有两个顶部blob的caffe python层编写向后函数?,neural-network,deep-learning,caffe,gradient-descent,pycaffe,Neural Network,Deep Learning,Caffe,Gradient Descent,Pycaffe,在ubuntu 16.04上安装caffe之后。我成功地训练了cifar10快速模型,然后添加了一个简单的python层,如下所示: import caffe import numpy as np class My_Custom_Layer(caffe.Layer): def setup(self, bottom, top): if len(bottom) != 1: raise Exception("Wrong number of bott

在ubuntu 16.04上安装caffe之后。我成功地训练了cifar10快速模型,然后添加了一个简单的python层,如下所示:

import caffe
import numpy as np

class My_Custom_Layer(caffe.Layer):  
    def setup(self, bottom, top):
        if len(bottom) != 1:
            raise Exception("Wrong number of bottom blobs")  

    def forward(self, bottom, top):
        top[0].data[...] = bottom[0].data

    def reshape(self, bottom, top):
        top[0].reshape(*bottom[0].shape)        

    def backward(self, top, propagate_down, bottom):
        bottom[0].diff[...] = top[0].diff
现在我想添加另一个顶部blob,顶部[1],底部[0]有一些更改,但我不知道如何更改向后函数