NetSpec: type-check Function inputs (they must be Top instances) #3153

Merged
merged 1 commit into from Apr 14, 2017

Conversation

Projects
None yet
3 participants
Contributor

jeffdonahue commented Oct 5, 2015

This adds simple type-checking for a common (at least for me) class of NetSpec use errors: the use of non-Top instances as inputs to Functions. The exception is raised when the Function is __init__ed rather than lazily when to_proto is called, making it easier to debug (IMO).

longjon was assigned by jeffdonahue Oct 5, 2015

Contributor

jeffdonahue commented Oct 5, 2015

(Fails Python3 Travis checks due to apparently different behavior of either regexps or unittest.assertRaisesRegexp; will look into debugging that pending @longjon's general approval of this. fixed, and I was of course wrong about the cause -- in Python 3 print ('%s' % type(())) prints <class 'tuple'> rather than <type 'tuple'>, so the regex needed to be generalized to handle that.)

@shelhamer shelhamer merged commit 1df3a25 into BVLC:master Apr 14, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Owner

shelhamer commented Apr 14, 2017

Thanks for the net spec check Jeff!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment