Skip to content

Comments

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

Merged
shelhamer merged 1 commit intoBVLC:masterfrom
jeffdonahue:netspec-type-check
Apr 14, 2017
Merged

NetSpec: type-check Function inputs (they must be Top instances)#3153
shelhamer merged 1 commit intoBVLC:masterfrom
jeffdonahue:netspec-type-check

Conversation

@jeffdonahue
Copy link
Contributor

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).

@jeffdonahue
Copy link
Contributor Author

(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.)

@jeffdonahue jeffdonahue force-pushed the netspec-type-check branch 5 times, most recently from 774bc4b to 1072539 Compare October 6, 2015 09:45
@shelhamer shelhamer merged commit 1df3a25 into BVLC:master Apr 14, 2017
@shelhamer
Copy link
Member

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants