Илья Ефимов Илья Ефимов - 1 year ago 481
Python Question

How to reshape layer in caffe with python?

It is possible to use

layer within a prototxt file.

However, trying to use it in python (using

n.resh = L.Reshape(n.fc3, reshape_param={'shape':'{dim:1 dim:1 dim:64 dim:64}'})

I got nothing but error:

AttributeError: 'BlobShape' object has no attribute 'append'

Answer Source


n.resh = L.Reshape(n.fc3, reshape_param={'shape':{'dim': [1, 1, 64, 64]}})

Note that the shape vector [1, 1, 64, 64] is passed as a list and not as a string like in the prototxt syntax.

In fact, any entry defined as repeated in caffe.proto, should be considered as a list/vector when interfacing using NetSpec.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download