add diagm
This commit is contained in:
parent
6dfb554e95
commit
697a300ec3
@ -31,7 +31,7 @@ graph(::typeof(svd), x) = svd(x)
|
|||||||
|
|
||||||
for op in (*, .*, .+, .^, log, exp, ceil, floor, sqrt, abs, cos,
|
for op in (*, .*, .+, .^, log, exp, ceil, floor, sqrt, abs, cos,
|
||||||
sin, tan, atan, asin, acos, tanh, lgamma, erf, erfc, real, imag, conj,
|
sin, tan, atan, asin, acos, tanh, lgamma, erf, erfc, real, imag, conj,
|
||||||
inv, det, transpose, permutedims, cat, length, diag)
|
inv, det, transpose, permutedims, cat, length, diag, diagm)
|
||||||
@eval graph(::typeof($op), args...) = $op(args...)
|
@eval graph(::typeof($op), args...) = $op(args...)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -39,6 +39,8 @@ end
|
|||||||
@test tf(@net x -> length(x))(A1) == length(A1)
|
@test tf(@net x -> length(x))(A1) == length(A1)
|
||||||
A = randn(Float32,(5,5))
|
A = randn(Float32,(5,5))
|
||||||
@test tf(@net x -> diag(x))(A) ≈ diag(A)
|
@test tf(@net x -> diag(x))(A) ≈ diag(A)
|
||||||
|
A = randn(Float32,(5,))
|
||||||
|
@test tf(@net x -> diagm(x))(A) ≈ diagm(A)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user