From 0b9436cfcdd9f893a16ee2ac7a2f244ba56af860 Mon Sep 17 00:00:00 2001 From: Ali Hamdi Date: Fri, 9 Jun 2017 21:50:25 +0200 Subject: [PATCH] add chol --- src/backend/tensorflow/graph.jl | 1 + test/backend/tensorflow.jl | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/backend/tensorflow/graph.jl b/src/backend/tensorflow/graph.jl index 2f0f21ad..b34e23a7 100644 --- a/src/backend/tensorflow/graph.jl +++ b/src/backend/tensorflow/graph.jl @@ -30,6 +30,7 @@ graph(::typeof(mean), x, dim=nothing) = TensorFlow.reduce_mean(x;axis=dim) graph(::typeof(svd), x) = svd(x) graph(::typeof(size), x, dim) = TensorFlow.size(x,convert(Tensor{Int32}, dim)) graph(::typeof(size), x) = TensorFlow.size(x) +graph(::typeof(chol), args...) = TensorFlow.transpose(TensorFlow.cholesky(args...)) for op in (*, .*, .+, .^, log, exp, ceil, floor, sqrt, abs, cos, sin, tan, atan, asin, acos, tanh, lgamma, erf, erfc, real, imag, conj, diff --git a/test/backend/tensorflow.jl b/test/backend/tensorflow.jl index 86867d31..1dcfdf53 100644 --- a/test/backend/tensorflow.jl +++ b/test/backend/tensorflow.jl @@ -44,6 +44,9 @@ end A = randn(4,5) @test tf(@net x -> size(x))(A) == [4,5] @test tf(@net (x,y) -> size(x,y))(A,1) == 4 + A = randn(6,5) + A = A'*A + @test tf(@net x -> chol(x))(A) ≈ chol(A) end end