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,
|
||||
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...)
|
||||
end
|
||||
|
||||
|
@ -39,6 +39,8 @@ end
|
||||
@test tf(@net x -> length(x))(A1) == length(A1)
|
||||
A = randn(Float32,(5,5))
|
||||
@test tf(@net x -> diag(x))(A) ≈ diag(A)
|
||||
A = randn(Float32,(5,))
|
||||
@test tf(@net x -> diagm(x))(A) ≈ diagm(A)
|
||||
end
|
||||
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user