-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Verify chain input-output #27
Conversation
src/simple_chain.jl
Outdated
input_dims(_) = nothing | ||
function _check_input_dims(x, i) | ||
d = input_dims(x) | ||
d === nothing || @assert d == i |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be better to throw an ArgumentError
rather than Assert
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A helpful error message would also be nice.
test/runtests.jl
Outdated
@@ -8,6 +8,14 @@ dual(x) = ForwardDiff.Dual(x, randn(), randn(), randn()) | |||
dual(x::ForwardDiff.Dual) = ForwardDiff.Dual(x, dual(randn()), dual(randn())) | |||
|
|||
@testset "SimpleChains.jl" begin | |||
# Should throw, as 8 ≠ 10 | |||
@test_throws AssertionError SimpleChain(( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ArgumentError
rather than assert?
This was accidentally built on top of part of #26, so I suggest merging that first rather than separating these.