This commit is contained in:
Ali Hamdi 2017-06-09 22:20:27 +02:00
parent 7aad224206
commit 2fce3b195e
3 changed files with 5 additions and 1 deletions

View File

@ -32,6 +32,7 @@ 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...))
graph(::typeof(reshape), x, dims) = TensorFlow.reshape(x,convert(Tensor{Int32},dims))
graph(::typeof(Flux.tile), args...) = TensorFlow.tile(args...)
for op in (*, .*, .+, .^, log, exp, ceil, floor, sqrt, abs, cos,
sin, tan, atan, asin, acos, tanh, lgamma, erf, erfc, real, imag, conj,

View File

@ -1,5 +1,6 @@
export reshape
export reshape, tile
import Base: reshape
reshape(x::AbstractArray, dims::AbstractArray) = reshape(x,tuple(dims...))
tile(x::AbstractArray, mult::AbstractArray) = repeat(x,outer=tuple(mult...))

View File

@ -49,6 +49,8 @@ end
@test tf(@net x -> chol(x))(A) chol(A)
A = randn(Float32,(6,3))
@test transpose(tf(@net (x,y) -> reshape(x,y))(transpose(A),[2,9])) reshape(A,(9,2)) # Note: TF is row major and julia is not
A = randn(Float32,(4,3,1))
@test tf(@net (x,y) -> Flux.tile(x,y))(A,[1,1,3]) repeat(A,outer=(1,1,3))
end
end