'4D-convolution on Python
I don't understand a few things in 4D-convolution. I have input tensor with dimension (5, 3, 17, 5), where:
batch_amount = 5
tensor_Height = 3
tensor_Weight = 17
tensor_Cin = 5
Parameters of kernel (3, 3, 5, 2):
kernel_X = 3
kernel_Y = 3
kernel_depth = 5
kernel_amount or C_out = 2
The bias is (2,):
b = [0.31862102 1.98459104]
How can I implement convolution and forward propagation with the current parameters using only numpy.
I tried to follow the example of this:
def stride_conv(arr1,arr2,s,p):
beg = 0
end = arr2.shape[0]
final = []
for i in range(0,arr1.shape[0]-1,s):
k = []
for j in range(0,arr1.shape[0]-1,s):
k.append(np.sum(arr1[beg+i : end+i, beg+j:end+j] * (arr2)))
final.append(k)
return np.array(final)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
