We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
like this?
import torch import onnx import coremltools as ct
model = ...
input_shape = (1, 1, 44100) input_sample = torch.randn(*input_shape)
onnx_model_path = 'model.onnx' torch.onnx.export(model, input_sample, onnx_model_path, input_names=['input'], output_names=['output'], opset_version=12)
coreml_model_path = 'model.mlmodel' coreml_model = ct.converters.onnx.convert(onnx_model_path, minimum_ios_deployment_target='13') coreml_model.save(coreml_model_path)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
like this?
import torch
import onnx
import coremltools as ct
构建PyTorch模型
model = ...
定义输入样本,假设输入维度为(1, 1, 44100),即单通道、采样率为44100的音频数据
input_shape = (1, 1, 44100)
input_sample = torch.randn(*input_shape)
将模型转换为ONNX模型
onnx_model_path = 'model.onnx'
torch.onnx.export(model, input_sample, onnx_model_path, input_names=['input'], output_names=['output'], opset_version=12)
将ONNX模型转换为Core ML模型
coreml_model_path = 'model.mlmodel'
coreml_model = ct.converters.onnx.convert(onnx_model_path, minimum_ios_deployment_target='13')
coreml_model.save(coreml_model_path)
The text was updated successfully, but these errors were encountered: