Skip to content

Conversation

nitnelave
Copy link
Contributor

This patch allows to specify enum values as strings when constructing a new layer. It looks up in the protobuf file the possible values, and gives the corresponding value or provides an error with the list of possible values.

@cdoersch
Copy link
Contributor

cdoersch commented Jul 5, 2016

What's wrong with caffe.layers.Eltwise(bottom,top,operation=caffe.params.Eltwise.PROD);?

@nitnelave
Copy link
Contributor Author

The string is closer to the prototxt, I find, so easier for the users.

I have to admit that I didn't find caffe.params.Eltwise.PROD (is it documented anywhere?).

I'm not too attached to this PR, I understand it can make the code a bit more brittle.

@nitnelave
Copy link
Contributor Author

I'm working on a YAML to prototxt converter that allows more compact descriptions of networks, and I didn't find a good way to specify generically enums from the YAML, so a string is a good value, I feel.

@ajtulloch
Copy link
Contributor

Yeah, I'm not a fan of this. If you want to add this logic, it should belong in your YAML -> protobuf converter. You can access enum values from Protobuf easily with the tools in https://developers.google.com/protocol-buffers/docs/reference/python-generated#enum, you might find a lot of value in that page for your convertor.

@ajtulloch ajtulloch closed this Jul 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants