add reshape
This commit is contained in:
parent
9e0b6af7a8
commit
7aad224206
@ -23,7 +23,7 @@ include("core.jl")
|
|||||||
import .FluxCore: back!, update!, graph
|
import .FluxCore: back!, update!, graph
|
||||||
|
|
||||||
include("utils.jl")
|
include("utils.jl")
|
||||||
|
include("ops.jl")
|
||||||
include("params.jl")
|
include("params.jl")
|
||||||
|
|
||||||
include("compiler/code.jl")
|
include("compiler/code.jl")
|
||||||
|
@ -31,6 +31,7 @@ graph(::typeof(svd), x) = svd(x)
|
|||||||
graph(::typeof(size), x, dim) = TensorFlow.size(x,convert(Tensor{Int32}, dim))
|
graph(::typeof(size), x, dim) = TensorFlow.size(x,convert(Tensor{Int32}, dim))
|
||||||
graph(::typeof(size), x) = TensorFlow.size(x)
|
graph(::typeof(size), x) = TensorFlow.size(x)
|
||||||
graph(::typeof(chol), args...) = TensorFlow.transpose(TensorFlow.cholesky(args...))
|
graph(::typeof(chol), args...) = TensorFlow.transpose(TensorFlow.cholesky(args...))
|
||||||
|
graph(::typeof(reshape), x, dims) = TensorFlow.reshape(x,convert(Tensor{Int32},dims))
|
||||||
|
|
||||||
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,
|
||||||
|
5
src/ops.jl
Normal file
5
src/ops.jl
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
export reshape
|
||||||
|
|
||||||
|
import Base: reshape
|
||||||
|
|
||||||
|
reshape(x::AbstractArray, dims::AbstractArray) = reshape(x,tuple(dims...))
|
@ -47,6 +47,8 @@ end
|
|||||||
A = randn(6,5)
|
A = randn(6,5)
|
||||||
A = A'*A
|
A = A'*A
|
||||||
@test tf(@net x -> chol(x))(A) ≈ chol(A)
|
@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
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user