Given a batch of samples, I would like to convolve each of them with different filters. I have implemented the idea with keras and the code works:
import keras.backend as K
def single_conv(tupl):
inp, kernel = tupl
outputs = K.conv1d(inp, kernel, padding='same')
return outputs
# inputs and filters are given in some way
res = K.squeeze(K.map_fn(single_conv, (inputs, filters), dtype=K.floatx()), axis=1)
Is there any way to do this with pytorch?