bsc-quantic / Tenet.jl

Composable Tensor Network library in Julia
https://bsc-quantic.github.io/Tenet.jl/
Apache License 2.0
22 stars 1 forks source link

Testing automatic differentiation of `contract` on `TensorNetwork`s fails #42

Closed jofrevalles closed 1 year ago

jofrevalles commented 1 year ago

Summary

When running ChainRulesTestUtils.test_frule and ChainRulesTestUtils.test_rrule on the contract function for a TensorNetwork the test fails. Currenly, testing on the contraction for TensorNetworks is disabled.

Example

julia> using Tenet
julia> tn = TensorNetwork([
           Tensor(rand(Complex{Float32}, 2, 2), (:y, :z)),
           Tensor(rand(Complex{Float32}, 2, 2), (:x, :y)),
           Tensor(rand(Complex{Float32}, 2, 2),(:x, :z))
           ])
TensorNetwork{Arbitrary}(#tensors=3, #inds=3)
julia> rrule(contract, tn)
(fill(-3.8262873f0 + 1.4557784f0im), Tenet.var"#contract_pullback#186"{Arbitrary, TensorNetwork{Arbitrary}}(TensorNetwork{Arbitrary}(#tensors=3, #inds=3)))
julia> test_rrule(contract, tn)
test_rrule: contract on TensorNetwork{Arbitrary}: Error During Test at /home/jofrevalles/.julia/packages/ChainRulesTestUtils/lERVj/src/testers.jl:202
  Got exception outside of a @test
  UndefRefError: access to undefined reference
  Stacktrace:
    ...
Test Summary:                                    | Error  Total  Time
test_rrule: contract on TensorNetwork{Arbitrary} |     1      1  0.0s
ERROR: Some tests did not pass: 0 passed, 0 failed, 1 errored, 0 broken.
mofeing commented 1 year ago

The Automatic Differentiation part has been moved to https://github.com/bsc-quantic/EinExprs.jl