def __init__(self, data: numpy.ndarray = None, dtype: type = DTYPE) -> None: """Constructor of a :class:`Tensor` object.""" if data is None: self._data = None elif isinstance(data, TensorValued): self._data = data.contract() elif isinstance(data, numpy.ndarray): self._data = data if dtype is None: dtype = self._data.dtype else: self._data = numpy.array(data) if dtype is None: dtype = self._data.dtype super().__init__(dtype)