-
Notifications
You must be signed in to change notification settings - Fork 27
Closed
Description
Bit of an edge case but:
using Test
using FiniteDifferences
x = rand(2,2)
@test typeof(rand_tangent(x)) == typeof(x) # Passes
x = rand(1,)
@test typeof(rand_tangent(x)) == typeof(x) # Passes
x = fill(rand())
@test typeof(rand_tangent(x)) == typeof(x) # Fails
idk how often this will come up, but in the case that x is a zero-array, presently rand_tangent will change it from Array{T, 0} to T. It came up when testing some test_rrules with zero-arrays.
I think defining rand_tangent(rng::AbstractRNG, x::StridedArray{T, 0}) where {T} would be sufficient here? So simple to fix, if it's wanted.
oxinabox, nickrobinson251 and mzgubic
Metadata
Metadata
Assignees
Labels
No labels