add svd
This commit is contained in:
parent
dac80081ba
commit
ee2e388228
@ -27,6 +27,7 @@ graph(::typeof(max), x, dim=nothing) = TensorFlow.reduce_max(x;axis=dim)
|
|||||||
graph(::typeof(all), x, dim=nothing) = TensorFlow.reduce_all(x;axis=dim)
|
graph(::typeof(all), x, dim=nothing) = TensorFlow.reduce_all(x;axis=dim)
|
||||||
graph(::typeof(any), x, dim=nothing) = TensorFlow.reduce_any(x;axis=dim)
|
graph(::typeof(any), x, dim=nothing) = TensorFlow.reduce_any(x;axis=dim)
|
||||||
graph(::typeof(mean), x, dim=nothing) = TensorFlow.reduce_mean(x;axis=dim)
|
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,
|
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)
|
||||||
|
@ -23,4 +23,18 @@ test_anon(tf)
|
|||||||
@test run(sess, Y, Dict(X=>xs)) ≈ d(xs)
|
@test run(sess, Y, Dict(X=>xs)) ≈ d(xs)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@testset "Ops" begin
|
||||||
|
|
||||||
|
error_margin = 1e-4
|
||||||
|
|
||||||
|
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
# svd
|
||||||
|
A = convert(Array{Float32},randn(5,5))
|
||||||
|
@net f(x) = svd(x)
|
||||||
|
m = tf(f)
|
||||||
|
u,s,v = m(A)
|
||||||
|
@test maximum(abs.(u*diagm(s)*transpose(v) - A)) < error_margin
|
||||||
|
|
||||||
|
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user