【发布时间】:2017-04-18 23:48:27
【问题描述】:
我正在尝试使用 Python 层在 Caffe 中实现转置功能。 下面是相同的代码。
但是,在Reshape() 方法中抛出boost::python::error_already_set 的实例后,它会抛出错误“终止调用。
有人可以说明我做错了什么吗?
import caffe
import numpy as np
class transpose(caffe.Layer):
def setup(self, bottom, top):
assert len(bottom) == 1, 'requires a single layer.bottom'
assert bottom[0].data.ndim == 2, 'requires matrix data'
assert len(top) == 1, 'requires a single layer.top'
def reshape(self, bottom, top):
top[0].reshape((bottom[0].data.shape[1], bottom[0].data.shape[0]))
def forward(self, bottom, top):
top[0].data = np.transpose(bottom[0].data)
def backward(self, top, propagate_down, bottom):
pass
谢谢你, 维杰塔。
【问题讨论】:
标签: machine-learning neural-network deep-learning caffe pycaffe