diff --git a/src/backend/tensorflow/graph.jl b/src/backend/tensorflow/graph.jl index 9b73cfa7..4235d047 100644 --- a/src/backend/tensorflow/graph.jl +++ b/src/backend/tensorflow/graph.jl @@ -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, diff --git a/src/ops.jl b/src/ops.jl index 69329b00..7c25ba56 100644 --- a/src/ops.jl +++ b/src/ops.jl @@ -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...)) diff --git a/test/backend/tensorflow.jl b/test/backend/tensorflow.jl index 7d1940e6..0fdd5421 100644 --- a/test/backend/tensorflow.jl +++ b/test/backend/tensorflow.jl @@ -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