Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions deps/build.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using PyCall
using Conda

const cur_version = "1.10.0"
const cur_py_version = "1.10.0"
const cur_version = "1.12.0"
const cur_py_version = "1.12.0"


############################
Expand Down
3 changes: 3 additions & 0 deletions deps/default_imports.txt
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,6 @@ Rank
Conv2DBackpropInput
Svd
Cross
FFT
ComplexAbs
MatrixSolve
6 changes: 3 additions & 3 deletions src/ops/transformations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -380,16 +380,16 @@ Returns:
local result
with_op_name(name, "Transpose") do
if perm === nothing
r = range(constant(0), LinearAlgebra.rank(n)-1)
r = range(constant(1), LinearAlgebra.rank(n))
perm = reverse(r, [true])
end
result = Ops.transpose(n, perm)
result = Ops.transpose(n, perm .- 1)
end
result
end

@op function Base.permutedims(n::AbstractTensor, perm; name=nothing)
transpose(n, perm .- 1; name=name)
transpose(n, perm; name=name)
end

@define_unary Base.adjoint transpose
Expand Down
8 changes: 8 additions & 0 deletions test/transformations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ end
@testset "Permute Dims" begin
@test ones(Float32, 4,3) == run(sess, transpose(ones(Tensor, (3, 4))))
@test ones(Float32, 4,3,2) == run(sess, permutedims(ones(Tensor, (4, 2, 3)), [1, 3, 2]))

A = rand(Float32, 5, 5, 5)
B = permutedims(A, [3,2,1])
c = TensorFlow.constant(A)
d = transpose(c, [3,2,1])
result = run(sess, d)
@test maximum(abs.(result-B))≈0.0

end


Expand Down