apple / apple/coremltools

multiple inputs pytorch model convert to coreml

Open
#1,715 5 comments 0 reactions 0 assignees View on GitHub
PyTorch (not traced) question
Dominant language
Python
Stars
5.4k
Forks
850
Avg merge
4d 5h
Merged PRs (30d)
10

Description

## ❓Question

- If this is a question about the Core ML Frame work or Xcode, please ask your question in the Apple Developer Forum: https://developer.apple.com/forums/

model have four images inputs, like [3, 224, 224], [3, 224, 224], [3, 224, 224], [3, 16, 16]
input_types = [ct.ImageType(name="F", shape=(224, 224, 3), bias=image_bias, scale=image_scale),
ct.ImageType(name="L", shape=(224, 224, 3), bias=image_bias, scale=image_scale),
ct.ImageType(name="R", shape=(224, 224, 3), bias=image_bias, scale=image_scale),
ct.ImageType(name="K", shape=(16, 16, 1), bias=image_bias, scale=image_scale)]

model is saved by torch.jit.save named as X, and load by torch.jit.load

when i use model = ct.convert(torch_model, inputs=input_types) get error:
ValueError: input_shape (length 0), kernel_shape (length 2), strides (length 2), dilations (length 2), and custom_pad (length 4) divided by two must all be the same length

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the failure at ct.convert(torch_model, inputs=input_types) with the four ct.ImageType inputs, using torch.jit.load on the model saved by torch.jit.save. Inspect the conversion traceback and input definitions; done means the failure is resolved or the supported input configuration and limitation are documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.