ITensor / ITensor/ITensorMPS.jl

`productMPS` not differentiable

Open
#65 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Julia
Stars
85
Forks
27
Avg merge
22m
Merged PRs (30d)
1

Description

sites = siteinds("Qubit", 3)

function f(x)
  ψ = productMPS(sites, "0")
  return x * inner(ψ,ψ)
end

f'(2.0)

Error:

ERROR: TypeError: in Type, in parameter, expected Type, got a value of type ITensor
Stacktrace:
  [1] _pullback
    @ ~/.julia/dev/ITensors/src/physics/sitetype.jl:106 [inlined]
  [2] _pullback(ctx::Zygote.Context, f::Type{SiteType}, args::UInt128)
    @ Zygote ~/.julia/packages/Zygote/Lw5Kf/src/compiler/interface2.jl:0
  [3] _pullback
    @ ~/.julia/dev/ITensors/src/physics/sitetype.jl:187 [inlined]
  [4] _pullback(ctx::Zygote.Context, f::typeof(ITensors._sitetypes), args::TagSet)
    @ Zygote ~/.julia/packages/Zygote/Lw5Kf/src/compiler/interface2.jl:0
  [5] _pullback
    @ ~/.julia/dev/ITensors/src/physics/sitetype.jl:190 [inlined]
  [6] _pullback(ctx::Zygote.Context, f::typeof(ITensors._sitetypes), args::Index{Int64})
    @ Zygote ~/.julia/packages/Zygote/Lw5Kf/src/compiler/interface2.jl:0
  [7] _pullback
    @ ~/.julia/dev/ITensors/src/physics/sitetype.jl:462 [inlined]
  [8] _pullback(::Zygote.Context, ::ITensors.var"##state#927", ::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, ::typeof(state), ::Index{Int64}, ::String)
    @ Zygote ~/.julia/packages/Zygote/Lw5Kf/src/compiler/interface2.jl:0
  [9] _pullback
    @ ~/.julia/dev/ITensors/src/physics/sitetype.jl:462 [inlined]
 [10] _pullback
...

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the example in the issue and start at physics/sitetype.jl:106, where the stack trace reports the TypeError during differentiation. Trace the productMPS/site-type path to determine the needed fix; done means f'(2.0) runs without this error.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.