import torch


def linear(x,wl1,wl2,bl1,bl2):
    """
    Linear layers on top of RNN cells in decoder part
    Args:
    - x:                         historical input sequence
    - wl1,wl2,bl1,bl2:           weights and biases
    Returns:
    - l1:                        output of first linear layer before ReLU 
    - r1:                        output of first linear layer after ReLU
    - l2:                        output of second linear layer
    """
    l1=torch.mm(x, wl1.t())+bl1
    r1=torch.relu(l1)
    l2=torch.mm(r1, wl2.t())+bl2
    return l1,r1,l2