import torch


def lagged_input(input, hist_len, hist_stride=1, time_stride=1, tensor_type=torch.float):
    """
    Introduce lagged history input from time series.
    
    :param torch.tensor input: input of shape (dimensions, timesteps)
    :param int hist_len: 
    :param int hist_stride: 
    :param int time_stride: 
    :param dtype tensor_type:
    :returns: lagged input tensor of shape (dimensions, time-H+1, history)
    :rtype: torch.tensor
    """
    in_unfold = input.unfold(-1, hist_len, time_stride)[:, :, ::hist_stride] # (dim, time, hist)
    return in_unfold