I have the following function:
It works okay when I have input as tensor, e.g.
input = torch.FloatTensor([[1, 2], [5, 6]])
But when I have input as Variable:
x = Variable(input, requires_grad=True)
it gives me the error that:
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-177-e1cc7f22bef8> in <module>()


----> 4 print(Test(x))

<ipython-input-176-405f14576c56> in Test(InputMatrix)
      7     DCT_Matrix = (torch.sin(Grid_R+0.05)*(Grid_R /D))
      8     print(DCT_Matrix)
----> 9     DCT_Output = torch.mm(DCT_Matrix,torch.t(torch.FloatTensor(InputMatrix)))
     10     return DCT_Output

RuntimeError: already counted a million dimensions in a given sequence. Most likely your items are also sequences and there's no way to infer how many dimension should the tensor have

Can anyone tell me what I need to do to fix this issue please.
P.S. I need to do backprob on this function later.
Q2: can i use a function from numpy, e.g. numpy.sin(x) and then use variable as an input? or should i write  the function in torch for getting the propagation?
Thanks
  def Test(InputMatrix):
    D = len(InputMatrix)
    Grid_R = torch.zeros(D,D)
    for i in range(len(Grid_R)):
        Grid_R[i][:] = i
        
    DCT_Matrix = (torch.sin(Grid_R+0.05)*(Grid_R /D))
    print(DCT_Matrix)
    DCT_Output = torch.mm(DCT_Matrix,torch.t(torch.FloatTensor(InputMatrix)))
    return DCT_Output