From 92616a8c3dc74f11e60e2eca62a4c2080b8fc510 Mon Sep 17 00:00:00 2001 From: Ali Hamdi Date: Thu, 8 Jun 2017 07:31:23 +0200 Subject: [PATCH] add inv --- src/backend/tensorflow/graph.jl | 3 ++- test/backend/tensorflow.jl | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/backend/tensorflow/graph.jl b/src/backend/tensorflow/graph.jl index c27ffec4..49daf657 100644 --- a/src/backend/tensorflow/graph.jl +++ b/src/backend/tensorflow/graph.jl @@ -30,7 +30,8 @@ graph(::typeof(mean), x, dim=nothing) = TensorFlow.reduce_mean(x;axis=dim) 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) + sin, tan, atan, asin, acos, tanh, lgamma, erf, erfc, real, imag, conj, + inv) @eval graph(::typeof($op), args...) = $op(args...) end diff --git a/test/backend/tensorflow.jl b/test/backend/tensorflow.jl index fd5e6a93..6fdef6cd 100644 --- a/test/backend/tensorflow.jl +++ b/test/backend/tensorflow.jl @@ -35,6 +35,12 @@ m = tf(f) u,s,v = m(A) @test maximum(abs.(u*diagm(s)*transpose(v) - A)) < error_margin +#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +# inv +@net f(x) = inv(x) +m = tf(f) +@test maximum(abs.(m(A)-inv(A))) < error_margin + #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% end