|
板凳
楼主 |
发表于 2020-6-2 16:48:34
|
只看该作者
Hi, 我的试验环境是:
rknn-toolkit 1.3.2
torch 1.2.0
测试代码如下:
- import torch
- import torch.nn as nn
- import numpy as np
- model = torch.nn.Tanh()
- dummy_input = torch.randn(1, 3, 32, 24)
- output = model(dummy_input)
- print(output.shape)
- traced = torch.jit.trace(model, dummy_input)
- traced.save('rknn_pytorch_tanh.pt')
- from rknn.api import RKNN
- rknn = RKNN(verbose=True)
- rknn.config()
- rknn.load_pytorch('rknn_pytorch_tanh.pt', input_size_list=[[3, 32, 24]])
执行结果是:
- ...
- warnings.warn(message)
- WARNING: Token 'COMMENT' defined, but not used
- WARNING: There is 1 unused token
- E Catch exception when loading pytorch model: rknn_pytorch_tanh.pt!
- E Traceback (most recent call last):
- E File "rknn/api/rknn_base.py", line 611, in rknn.api.rknn_base.RKNNBase.load_pytorch
- E File "rknn/base/RKNNlib/app/importer/import_pytorch.py", line 97, in rknn.base.RKNNlib.app.importer.import_pytorch.ImportPytorch.run
- E File "rknn/base/RKNNlib/converter/convert_pytorch.py", line 570, in rknn.base.RKNNlib.converter.convert_pytorch.convert_pytorch.__init__
- E File "rknn/base/RKNNlib/converter/convert_pytorch.py", line 654, in rknn.base.RKNNlib.converter.convert_pytorch.convert_pytorch.model_simplify
- E File "rknn/base/RKNNlib/converter/convert_pytorch.py", line 113, in rknn.base.RKNNlib.converter.convert_pytorch.torch_inference_engine.shape_pick
- E File "rknn/base/RKNNlib/converter/convert_pytorch.py", line 148, in rknn.base.RKNNlib.converter.convert_pytorch.torch_inference_engine.__ir_shape_inference
- E KeyError: 'aten::tanh'
|
|