Skip to content

No .exp() method in Torch Backend #54

@WeiguoMa

Description

@WeiguoMa

Issue Description

It seems that there is no exp() method in torch backend, both in tensorcircuit-ng.backend and tensornetwork-ng. This might be caused by historical factors. Generally, I do think this function should be added in tensornetwork-ng.

How to Reproduce

import tensorcircuit as tc
tc.set_backend("pytorch")
c = tc.Circuit(2)
c.u(0)

Error Output

File /opt/miniconda3/envs/weiguoQ/lib/python3.12/site-packages/tensornetwork/backends/abstract_backend.py:833, in AbstractBackend.exp(self, tensor)
    825 def exp(self, tensor: Tensor) -> Tensor:
    826     """
    827     Return elementwise exp of `tensor`.
    828     Args:
   (...)    831       Tensor
    832     """
--> 833     raise NotImplementedError(
    834         "Backend '{}' has not implemented `exp`.".format(self.name)
    835     )

NotImplementedError: Backend 'pytorch' has not implemented `exp`.

Environment Context

OS info: macOS-26.0-arm64-arm-64bit
Python version: 3.10.18
Numpy version: 1.26.4
Scipy version: 1.15.2
Pandas version: 2.3.1
TensorNetwork version: 0.5.1
Cotengra version: 0.7.5
TensorFlow version: 2.15.0
TensorFlow GPU: []
Jax version: 0.6.2
Jax installation doesn't support GPU
JaxLib version: 0.6.2
PyTorch version: 2.2.2
PyTorch GPU support: False
PyTorch GPUs: []
Cupy is not installed
Qiskit version: 0.46.3
Cirq version: 1.4.1
TensorCircuit version 1.4.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions