Numpy, Apply A List Of Functions Along Array Dimension
I have a list of functions of the type: func_list = [lambda x: function1(input), lambda x: function2(input), lambda x: function3(input), lamb
Solution 1:
You can iterate over your function list using np.apply_along_axis
:
import numpy as npx= np.ranom.randn(100, 100)
for f in fun_list:
x = np.apply_along_axis(f, 0, x)
Based on OP's Update
Assuming your functions and batches are the same in size:
batch = ... # tuple of 4 images batch_out = tuple([np.apply_along_axis(f, 0, x) for f, x in zip(fun_list, batch)])
Post a Comment for "Numpy, Apply A List Of Functions Along Array Dimension"