Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
PythonLayer takes parameters by string #2871
Conversation
shelhamer
added the
Python
label
Aug 6, 2015
This was referenced Aug 6, 2015
|
@philkr have you adapted this test to Python 3 already? |
philkr
commented on an outdated diff
Aug 6, 2015
| + bottom[0].diff[...] = top[0].diff | ||
| + def _forward_mul(self, bottom, top): | ||
| + top[0].data[...] = bottom[0].data * self.value_ | ||
| + def _backward_mul(self, bottom, propagate_down, top): | ||
| + bottom[0].diff[...] = top[0].diff * self.value_ | ||
| + def reshape(self, bottom, top): | ||
| + top[0].reshape(bottom[0].num, bottom[0].channels, bottom[0].height, | ||
| + bottom[0].width) | ||
| + def forward(self, bottom, top): | ||
| + self._forward(bottom, top) | ||
| + def backward(self, top, propagate_down, bottom): | ||
| + self._backward(bottom, propagate_down, top) | ||
| + | ||
| + | ||
| +def python_net_file(): | ||
| + f = tempfile.NamedTemporaryFile(delete=False) |
philkr
Contributor
|
|
The python3 error is easy to fix (see above). I have no idea why python2 fails on those warnings... |
|
@shelhamer @philkr Thank you so much for taking care of my previous PR! Other than this, I still have a bunch of PRs for python that are not finished. If I need to update and polish them, please let me know. |
|
According to this post in Stack Overflow, maybe we have to include |
|
Hmm, the branch CI had passed but this is an issue. I'll try to fix it shortly. |
|
@jeffdonahue @longjon does anybody have a favorite name or is |
|
I think |
shelhamer
added the
JL
label
Aug 6, 2015
|
I changed the name of the property to |
shelhamer
added the
ready for review
label
Aug 6, 2015
longjon
commented on an outdated diff
Aug 7, 2015
| + top[0].reshape(*bottom[0].data.shape) | ||
| + | ||
| + def forward(self, bottom, top): | ||
| + top[0].data[...] = self.value * bottom[0].data | ||
| + | ||
| + def backward(self, top, propagate_down, bottom): | ||
| + bottom[0].diff[...] = self.value * top[0].diff | ||
| + | ||
| + | ||
| +def python_param_net_file(): | ||
| + with tempfile.NamedTemporaryFile(mode='w+', delete=False) as f: | ||
| + f.write("""name: 'pythonnet' force_backward: true | ||
| + input: 'data' input_shape { dim: 10 dim: 9 dim: 8 } | ||
| + layer { type: 'Python' name: 'mul10' bottom: 'data' top: 'mul10' | ||
| + python_param { module: 'test_python_layer_with_param_str' | ||
| + layer: 'SimpleParamLayer' param_str: "10" } } |
|
|
longjon
commented on an outdated diff
Aug 7, 2015
|
Looks good except as noted. |
|
Thanks for the glance @longjon. Fixed and merging. |
shelhamer
added a commit
that referenced
this pull request
Aug 7, 2015
|
|
shelhamer |
5986a37
|
shelhamer commentedAug 6, 2015
Cherry-picking of the PythonLayer string parameter from #2001 by @tnarihi to give
PythonLayeraparam_strmember for passing parameters through thepython_paramproto message.This is a simple change in itself that leaves the choice of what and how to parameterize open.
There is no automatic
eval