def _calc_T_var(self,X) -> int:
        """Calculate the number of samples, T, from the shape of X"""
        shape = X.shape
        tensor_rank: int = len(shape)
        if tensor_rank == 0:
            return 1
        if tensor_rank == 1:
            return shape[0]
        if tensor_rank == 2:
            if shape[1] > 1:
                raise ValueError('Initial value of a variable must have dimension T*1.')
            return shape[0]
def _calc_T_var ( self , X ) -> int : shape = X . shape tensor_rank : int = len ( shape ) if tensor_rank == 0 : return 1 if tensor_rank == 1 : return shape [ 0 ] if tensor_rank == 2 : if shape [ 1 ] > 1 : raise ValueError ( 'Initial value of a variable must have dimension T*1.' ) return shape [ 0 ]
Calculate the number of samples, T, from the shape of X