Search code examples
3d-convolution

how to provide input channel dimension for nnabla convolution operation?


i was trying to write convolution layer in nnable using nnabla.parametric_functions, how do i provide the input channel dimensions to it ?

I tried to look into nnabla docs at https://nnabla.readthedocs.io/en/latest/python/api/parametric_function.html?highlight=convolution#nnabla.parametric_functions.convolution

Here is the code snippet:

import numpy as np

import nnabla as nn

import nnabla.functions as F

import nnabla.parametric_functions as PF

input = nn.Variable([1,3,224,224]) projection = PF.convolution(input, 768,(16,16), stride=(16,16), name='projection_conv') print("conv", projection.shape)


Solution

  • In NNabla, For PF.convolution(), you only need to specify the output channel dimension i.e. outmaps not input channel dimension. API will itself infer it from the input variable in the backend.