If n is therefore supposed to be a the “depth” on the input, you would have to create the input as [batch_size, channels, depth, height, width]:
x=torch.rand(B,int(np.ceil(0.1*b*b)),n,h,w,)
conv=nn.Conv3d(int(np.ceil(0.1*b*b)),b*b,kernel_size)

and use a 3D convolution.