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

ghostnet_pytorch中的hardsigmoid无法转成onnx的hardsigmoid #190

Open
DamonsJ opened this issue Mar 27, 2023 · 1 comment
Open

ghostnet_pytorch中的hardsigmoid无法转成onnx的hardsigmoid #190

DamonsJ opened this issue Mar 27, 2023 · 1 comment

Comments

@DamonsJ
Copy link

DamonsJ commented Mar 27, 2023

测试了ghostnet_pytorch中的模型,用的预训练的pth,转成onnx
结果hardsigmoid拆成了3个,不是单独的hardsigmoid是为什么呢?
这么转的onnx:
def main():
args = parser.parse_args()

model = ghostnet(num_classes=args.num_classes, width=args.width, dropout=args.dropout)
model.load_state_dict(torch.load('./models/state_dict_73.98.pth'))
args.num_gpu = 0
if args.num_gpu > 1:
    model = torch.nn.DataParallel(model, device_ids=list(range(args.num_gpu))).cuda()
elif args.num_gpu < 1:
    model = model
else:
    model = model.cuda()
print('GhostNet created.')

model.eval()
x=torch.randn((1,3,224,224))
torch.onnx.export(model, x, 'ghostnet.onnx', opset_version=11)
@iamhankai
Copy link
Member

It's normal.

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