Hi Lam!



 Lam_Nguyen:

Is there a simple and clean way to define F such that :
F(v) = (f(v_1),f(v_2),f(v_3),…,f(v_n)) ?
Without using for loops, possibly by parallelizing the computation? As each instance instance of the function f are independant from each other.


As far as I am aware, pytorch does not have this kind of “map”
function.
However, pytorch supports many different functions that act
element-wise on tensors (arithmetic, cos(), log(), etc.).  If you
can rewrite your function using element-wise torch tensor
operations, your composite function will also act element-wise,
and will do what you want.
Good luck.
K. Frank