Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pnnx怎么转换rvm mobilenetv3这种多输入模型到ncnn呢? #4123

Open
sankexin opened this issue Aug 9, 2022 · 1 comment
Open

pnnx怎么转换rvm mobilenetv3这种多输入模型到ncnn呢? #4123

sankexin opened this issue Aug 9, 2022 · 1 comment

Comments

@sankexin
Copy link

sankexin commented Aug 9, 2022

error log | 日志或报错信息 | ログ

terminate called after throwing an instance of 'c10::Error'
what(): forward() is missing value for argument 'r1'. Declaration: forward(torch.model.model.MattingNetwork self, Tensor src, Tensor r1, Tensor r2, Tensor r3, Tensor r4, Tensor downsample_ratio) -> (Tensor[])
Exception raised from checkAndNormalizeInputs at /pytorch/aten/src/ATen/core/function_schema_inl.h:239 (most recent call first):
frame #0: c10::Error::Error(c10::SourceLocation, std::string) + 0x42 (0x7fdf348a9a22 in /usr/local/lib/python3.7/site-packages/torch/lib/libc10.so)
frame #1: c10::detail::torchCheckFail(char const*, char const*, unsigned int, std::string const&) + 0x5b (0x7fdf348a63db in /usr/local/lib/python3.7/site-packages/torch/lib/libc10.so)
frame #2: + 0xf182ed (0x7fdf21fb72ed in /usr/local/lib/python3.7/site-packages/torch/lib/libtorch_cpu.so)
frame #3: torch::jit::GraphFunction::operator()(std::vector<c10::IValue, std::allocatorc10::IValue >, std::unordered_map<std::string, c10::IValue, std::hashstd::string, std::equal_tostd::string, std::allocator<std::pair<std::string const, c10::IValue> > > const&) + 0x2d (0x7fdf24627fcd in /usr/local/lib/python3.7/site-packages/torch/lib/libtorch_cpu.so)
frame #4: torch::jit::Method::operator()(std::vector<c10::IValue, std::allocatorc10::IValue >, std::unordered_map<std::string, c10::IValue, std::hashstd::string, std::equal_tostd::string, std::allocator<std::pair<std::string const, c10::IValue> > > const&) + 0x138 (0x7fdf246355f8 in /usr/local/lib/python3.7/site-packages/torch/lib/libtorch_cpu.so)
frame #5: + 0x8ee83 (0x561c35707e83 in ./build/src/pnnx)
frame #6: + 0x8ca5f (0x561c35705a5f in ./build/src/pnnx)
frame #7: + 0x6db62 (0x561c356e6b62 in ./build/src/pnnx)
frame #8: + 0x3c56d (0x561c356b556d in ./build/src/pnnx)
frame #9: __libc_start_main + 0xe7 (0x7fdedda05c87 in /lib/x86_64-linux-gnu/libc.so.6)
frame #10: + 0x3a9da (0x561c356b39da in ./build/src/pnnx)

model | 模型 | モデル

  1. original model
    rvm_mobilenetv3_fp32.zip

how to reproduce | 复现步骤 | 再現方法

1.使用转换命令为:./build/src/pnnx rvm_mobilenetv3_fp32.pt inputshape=[1,3,1080,1920]
2.模型的输入本来应该是六个:src = torch.randn(1, 3, 1080, 1920).to("cpu")、rec = (torch.zeros([1, 1, 1, 1]).to("cpu"),) * 4、downsample_ratio = torch.tensor([0.25])
3.

@csukuangfj
Copy link
Contributor

直接上代码吧

fprintf(stderr, " inputshape=[1,3,224,224],...\n");
fprintf(stderr, " inputshape2=[1,3,320,320],...\n");

std::vector<std::vector<int64_t> > input_shapes;
std::vector<std::string> input_types;
std::vector<std::vector<int64_t> > input_shapes2;

目前代码里面,只支持最多指定两个 input shape.

要支持多于两个,你需要修改如下代码:

if (strcmp(key, "inputshape") == 0)
parse_shape_list(value, input_shapes, input_types);
if (strcmp(key, "inputshape2") == 0)
parse_shape_list(value, input_shapes2, input_types2);
if (strcmp(key, "customop") == 0)

在 252 行后面,依次添加对 inputshape3, inputshape4, ... 的处理。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants