add diagm

This commit is contained in:
Ali Hamdi 2017-06-09 21:32:50 +02:00
parent 6dfb554e95
commit 697a300ec3
2 changed files with 3 additions and 1 deletions

View File

@ -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

View File

@ -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