|
按照你们demo中upsample 的格式改造了代码,代码如下,模型能够正常住转换成onnx模型,但是从onnx 转rknn 遇到not match upsample 的问题,我的环境是pytorch 1.2.0 onnx 1.4.1 还是报错, 你们rknn 支持 IR_version 4 吗?
- def forward(self, x, skip, concat=True):
- if x.size()[1] != 320:
- # out = F.interpolate(
- # x,
- # size=(skip.size(2), skip.size(3)),
- # mode="bilinear",
- # align_corners=False)
- upsample = nn.Upsample(size=(skip.size(2), skip.size(3)), mode='nearest')
- out = upsample(x)
- else:
- out = self.deconv(x)
- # self.deconv.weight.data(3, 3, 4)
- # out = self.deconv(x)
- print('after upsample', out.size(),skip.size(2), skip.size(3))
- if concat:
- out = torch.cat([out, skip], 1)
- print('upsample concat', out.size(), skip.size(2), skip.size(3))
- return out
|
|