Conversation
Ah, I usually use |
What's the error you're seeing?
Actually, yes it does. Turn on the diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3056d75..d53be93 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -99,7 +99,7 @@ add_custom_target(lint COMMAND ${CMAKE_COMMAND} -P ${PROJECT_SOURCE_DIR}/cmake/l
# ---[ pytest target
if(BUILD_python)
- add_custom_target(pytest COMMAND python${python_version} -m unittest discover -s caffe/test WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/python )
+ add_custom_target(pytest COMMAND python${python_version} -m unittest discover -v -s caffe/test WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/python )
add_dependencies(pytest pycaffe)
endif() |
lukeyeager
left a comment
There was a problem hiding this comment.
I can't see that any of these changes are required.
| layer.convolution_param.stride[0] if len(layer.convolution_param.stride) else 1, | ||
| separator, | ||
| layer.convolution_param.pad[0] if len(layer.convolution_param.pad._values) else 0) | ||
| layer.convolution_param.pad[0] if len(layer.convolution_param.pad) else 0) |
There was a problem hiding this comment.
Why do you think this is necessary?
>>> from caffe.proto import caffe_pb2
>>> net = caffe_pb2.NetParameter()
>>> layer = net.layer.add()
>>> layer.convolution_param.kernel_size
[]
>>> layer.convolution_param.kernel_size.append(1)
>>> layer.convolution_param.kernel_size
[1]
>>> len(layer.convolution_param.kernel_size)
1
>>> len(layer.convolution_param.kernel_size._values)
1Looks like it should work as-is.
There was a problem hiding this comment.
I'm getting AttributeError: 'google.protobuf.pyext._message.RepeatedScalarConta' object has no attribute '_values' when trying with the included example nets.
This happens when using protobuf>2.6.1 (NVIDIA#303). I have tested the PR with protobuf==2.5.0 and it works fine, just in case.
| import unittest | ||
|
|
||
| from google import protobuf | ||
| from google.protobuf import text_format |
There was a problem hiding this comment.
Personally, I feel like the existing syntax is slightly clearer.
There was a problem hiding this comment.
The existing syntax is more clear, but its returning error:
AttributeError: 'module' object has no attribute 'text_format'
Replacing the import statement as mentioned in PR fixed it. draw_net.py also uses the same syntax, probably because of this issue.
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| unittest.main() |
There was a problem hiding this comment.
This isn't necessary when the pytest target is python -m unittest discover
There was a problem hiding this comment.
Yes this isn't necessary when running the unittest as you mentioned. My bad!
|
Aha! So all the fixes are for |
|
Thanks for the further fixes @nitheeshas ! |
The previous fix #5477 for draw_net had some issues
draw.pystill wasn't working for most of the nets.unittest.main()(not sure if there is any way to run unittest without this).text_formatshould befrom google.protobuf import text_format.These are fixed in this PR.