DoubleTensor#

class DoubleTensor#

A thin wrapper over a boost::numeric::ublas::tensor<double> object. Uses the first-order convention.

add_scalar(self: pyhelayers.DoubleTensor, val: float) None#

Adds given scalar to all elements.

Parameters:

val (double) – the scalar to add.

assert_equals(self: pyhelayers.DoubleTensor, other: pyhelayers.DoubleTensor, title: str, eps: float = 1e-05, relative: bool = False) float#

Verifies this tensor equals other tensor. Returns the mean squared error (MSE).

Parameters:
  • other (DoubleTensor) – The other tensor to verify equality to.

  • title (string) – A title to print in case the assertion fails.

  • eps (double) – The maximal diff allowed in each slot between this and other. Defaults to 1e-5.

  • relative (boolean) – Whether to apply comparison with respect to relative difference between values. Defaults to false.

to_numpy(self: pyhelayers.DoubleTensor) numpy.ndarray[numpy.float64]#

Converts a DoubleTensor to a numpy array.