Pytorch function calling

Viewed 67

I am trying to compute a trignometric function using pytorch, but having issues while calling it via function, below is my code:-

def func(x,y):
  return torch.exp(torch.sin(x)/x-y)

func(torch.tensor[2,3])



Error:-
TypeError - Traceback (most recent call last)
<ipython-input-16-beb818f912f5> in <module>()
----> 1 func(torch.tensor([2, 3]))

TypeError: newf() missing 1 required positional argument: 'y'

What is incorrect in this code while calling the function?

1 Answers

You need to do it with unpacking:

func(*torch.tensor[2,3])
Related