utils.integrands package

Functions defined on the unit hypercube for the purpose of integration tests

sanitize_variable(x, device=None)[source]

Prepare input variable for a pytorch function: if it is a python numerical variable or a numpy array, then cast it to a tensor if it is is a tensor, make a copy to make sure the function cannot be altered from outside

Parameters
  • x (float or np.ndarray or torch.Tensor) –

  • device (None or torch.device) –

Returns

Return type

torch.Tensor

Submodules