I defined a tensor like this
t_shape = [4, 1]
data = torch.rand(t_shape)
I want to apply different functions to each row.
funcs = [lambda x: x+1, lambda x: x**2, lambda x: x-1, lambda x: x*2] # each function for each row.
I can do it with the following code
d = torch.tensor([f(data[i]) for i, f in enumerate(funcs)])
How can I do it in a proper way with more advanced APIs defined in PyTorch?