Skip to content

reverse AD doesn't support planarspace #156

@XingyuZhang2018

Description

@XingyuZhang2018

A MVE:

using Test, Random, TensorKit, Zygote
using TensorKit: ℙ

@testset "plansor" begin
    vecspace = ℙ # ℂ works
    A = TensorMap(randn, ComplexF64, vecspace^2 ← vecspace^2)
    x = TensorMap(randn, ComplexF64, vecspace^2 ← vecspace^2)

    function f(x)
        @plansor y[-1; -2] := A[-1; 1] * x[1; -2]
        return real(dot(y, y))
    end
    @show f(x)
    @show Zygote.gradient(f, x)
end

Output:

f(x) = 1.2352920663031943
plansor: Error During Test at c:\Users\86412\Desktop\research\MPSKit.jl\test\ad.jl:56
  Got exception outside of a @test
  Can't differentiate foreigncall expression $(Expr(:foreigncall, :(Core.tuple(:zgemm_64_, LinearAlgebra.BLAS.libblastrampoline)), Nothing, svec(Ref{UInt8}, Ref{UInt8}, Ref{Int64}, Ref{Int64}, Ref{Int64}, Ref{ComplexF64}, Ptr{ComplexF64}, Ref{Int64}, Ptr{ComplexF64}, Ref{Int64}, Ref{ComplexF64}, Ptr{ComplexF64}, Ref{Int64}, Int32, Int32), 0, :(:ccall), %69, %71, %73, %75, %77, %79, %81, %83, %85, %87, %89, %91, %93, %94, %95, %67, %66, %65, %61, %59, %57, %53, %51, %47, %45, %43, %41, %39, %37, %35)).
  You might want to check the Zygote limitations documentation.
  https://fluxml.ai/Zygote.jl/latest/limitations

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions