kli_nlpr
kli_nlpr

Reputation: 914

caffe LayerSetUp and Reshape?

I am reading caffe source code now.
I am confused about LayerSetUp and Reshape methods.
Some layers have both of these methods, others have one or none... Why? Can anyone explain this to me?

Upvotes: 1

Views: 821

Answers (1)

Shai
Shai

Reputation: 114786

LayerSetUp is called once when loading the net. It's aim is to
(a) Verify the layer has exactly the right number of input/output blobs
(b) Read the parameters of the layer from the prototxt
(c) Initialize internal parameters

On the other hand, Reshape is used to allocate memory for parameters and output blobs and can be called even after the net was setup. For instance, it is common for detection networks to change the input shape, thus Reshapeing all consequent blobs.

Upvotes: 6

Related Questions