MNN icon indicating copy to clipboard operation
MNN copied to clipboard

Error for MNN/source/shape/ShapeSqueeze.cpp, 80

Open kl456123 opened this issue 7 years ago • 6 comments

What's wrong with the problem, I am new to MNN, I can only get this line but I know nothing about their meanings

MNN_ASSERT(squeezeDimSize< ib.dimensions);

kl456123 avatar Nov 11 '19 03:11 kl456123

The number of Squeeze parameter(squeeze dim) you specify should be less than the input dimension

czy2014hust avatar Nov 11 '19 03:11 czy2014hust

The problem is that how to convert the following code, Can I make it?

 def xcorr_depthwise(x, kernel):
          """depthwise cross correlation
          """
          batch = kernel.size(0)
          channel = kernel.size(1)
         x = x.view(1, batch*channel, x.size(2), x.size(3))
         kernel = kernel.view(batch*channel, 1, kernel.size(2), kernel.size(3))
         out = F.conv2d(x, kernel, groups=batch*channel)
         out = out.view(batch, channel, out.size(2), out.size(3))
         return out

kl456123 avatar Nov 11 '19 04:11 kl456123

I try to solve it. It cost me much time to make it. I think the error info is helpless for me...

def xcorr_depthwise(x, kernel):
    """depthwise cross correlation
    """
    batch = kernel.size(0)
    channel = kernel.size(1)
    kernel = kernel.squeeze(0).unsqueeze(1)
    new_kernel = torch.rand(256,1, 5,5,  device='cpu')
    new_kernel.copy_(kernel)
    out = F.conv2d(x, new_kernel, groups=256)

several places should be pointed out.

  1. view op is needed
  2. tensor size is very strange, Converter cannot get the correct size of tensor.

kl456123 avatar Nov 11 '19 06:11 kl456123

Please use netron to check the squeeze parameter in the onnx model. Put it in the below comment.

czy2014hust avatar Nov 11 '19 08:11 czy2014hust

OK, I will read your source code to know more. Thanks all the same

kl456123 avatar Nov 11 '19 08:11 kl456123

你好,请问转换成mnn模型,xcorr_depthwise中的卷积操作,kernel参数可以传进去吗?

dan520520520 avatar Apr 21 '22 03:04 dan520520520