qml.interfaces.torch

This module contains the to_torch() function to convert Numpy-interfacing quantum nodes to PyTorch compatible quantum nodes.

Functions

args_to_numpy(args)

Converts all Torch tensors in a list to NumPy arrays

kwargs_to_numpy(kwargs)

Converts all Torch tensors in a dictionary to NumPy arrays

to_torch(qnode)

Function that accepts a QNode, and returns a PyTorch-compatible QNode.

unflatten_torch(flat, model)

Restores an arbitrary nested structure to a flattened Torch tensor.