Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

tf.function property in pytorch

I'm a beginner in pytorch, and I have some functions that are needed to implement in network.

My question is: is there any way like tf.function, or should I use "class(nn.Module)" with variable?

For example, let X be a 10x2 matrix . In pseudo-code:

a = Variable(1.0) 
b = Variable(1.0)
Y = a*X[:,0]**2 + b*X[:,1]
like image 737
ncalik Avatar asked Sep 17 '25 07:09

ncalik


1 Answers

In PyTorch you don't need things like tf.function, you just use normal Python code (because of the dynamic graph).

Please give more detailed example (with code) of what you're trying to do if the above doesn't answer your question.

like image 94
Sergii Dymchenko Avatar answered Sep 19 '25 16:09

Sergii Dymchenko