tensorly / quantum

Tensor-Based Quantum Machine Learning
http://tensorly.org/quantum/dev/
BSD 3-Clause "New" or "Revised" License
115 stars 17 forks source link

TypeError: `spins_to_tt_state()` got an unexpected keyword argument 'dtype' #8

Open MonitSharma opened 4 months ago

MonitSharma commented 4 months ago

While running the Multi-Basis Encodig code, I got the error mentioned above.

state = tlq.spins_to_tt_state([0 for i in range(nqubits)], device=device, dtype=dtype) # generate generic zero state |00000>
state = tlq.qubits_contract(state, ncontraq) 

I checked the GitHub and found that the code is indeed correct, i.e it does take dtype as an argument :

def spins_to_tt_state(spins, device='cpu', dtype=complex64):
    """ Generates tt-tensor state of computational basis product space described by spins.

    Parameters
    ----------
    spins : List/tensor of ints (0's and 1's), spin values

    Returns
    -------
    tt-tensor product state in the computational basis
    """

Since I installed tensorly-quantum using a pip command, maybe a previous version was installed where this was an issue.

It works fine when I make use of the GitHub fork of the same repo, rather than the pip installed one.