TuckerTensorTrain.segment ========================= .. py:method:: t3toolbox.tucker_tensor_train.TuckerTensorTrain.segment(start, stop) .. code-block:: python def segment( self, start: int, # requires stop > start stop: int, # requires stop > start ) -> 'TuckerTensorTrain': Extract contiguous segment of this TuckerTensorTrain. Segments must have length at least one. :param start: Starting index for segment. Requires ``stop > start``. :type start: int :param stop: Stopping index for segment. Requires ``stop > start``. :type stop: int :returns: Segment of this TuckerTensorTrain, with ``shape=(N(start), ..., N(stop-1))``. :rtype: TuckerTensorTrain :raises ValueError: If ``stop <= start``. .. seealso:: :py:meth:`.TuckerTensorTrain.concatenate` .. rubric:: Examples >>> import numpy as np >>> import t3toolbox.tucker_tensor_train as t3 >>> randn = np.random.randn >>> tucker_cores = (randn(4,14), randn(5,15), randn(6,16), randn(7,17)) >>> tt_cores = (randn(2,4,3), randn(3,5,2), randn(2,6,2), randn(2,7,4)) >>> x = t3.TuckerTensorTrain(tucker_cores, tt_cores) >>> x01 = x.segment(1,3) >>> print(x01.core_shapes) (((5, 15), (6, 16)), ((3, 5, 2), (2, 6, 2)))