def ScalarMultiply(val, name='unnamed'):
    # language=rst
    """
    Multiply an input by a constant scalar value

    :param val - The constant value
    """
    def init_fun(key, input_shape):
        params = ()
        state = ()
        return name, input_shape, params, state

    def apply_fun(params, state, inputs, **kwargs):
        return inputs*val, state

    return init_fun, apply_fun