def _temp_pad(F, x, padding=1, zeros=True):
    """
    Pads a 3D input along temporal axis by repeating edges or zeros
    Args:
        x: dim 5 b,t,c,w,h
        padding: the number of dim to add on each side
        zeros: pad with zeros?

    Returns: padded x

    """
    first = x.slice_axis(axis=1, begin=0, end=1)  # symbol compatible indexing
    last = x.slice_axis(axis=1, begin=-1, end=None)
    if zeros:
        first = first * 0
        last = last * 0
    if padding > 1:
        first = first.repeat(repeats=padding, axis=1)
        last = last.repeat(repeats=padding, axis=1)

    x = F.concat(first, x, dim=1)
    x = F.concat(x, last, dim=1)

    return x