qml.math.get_interface

get_interface(tensor)[source]

Returns the name of the package that any array/tensor manipulations will dispatch to. The returned strings correspond to those used for PennyLane interfaces.

Parameters

tensor (tensor_like) – tensor input

Returns

name of the interface

Return type

str

Example

>>> x = torch.tensor([1., 2.])
>>> get_interface(x)
'torch'
>>> from pennylane import numpy as np
>>> x = np.array([4, 5], requires_grad=True)
>>> get_interface(x)
'autograd'