qml.math.detach

detach(tensor, like=None)[source]

Detach a tensor from its trace and return just its numerical values.

Parameters:
  • tensor (tensor_like) – Tensor to detach

  • like (str) – Manually chosen interface to dispatch to.

Returns:

A tensor in the same interface as the input tensor but with a stopped gradient.

Return type:

tensor_like