@Ja-Keoung_Koo Because all your operations are already differentiable by autograd, you don’t need to create a new torch.autograd.Function for that.
You can simply define a python function, and it will perform as expected:
def mul_scalar(T, s_var):
    # supposes that T is 1D var
    # need to unsqueeze s_var if not
    return T * s_var.expand_as(T)