-
Notifications
You must be signed in to change notification settings - Fork 646
Open
Labels
backend testerThis bug was found by the backend test suite.This bug was found by the backend test suite.module: coremlIssues related to Apple's Core ML delegation and code under backends/apple/coreml/Issues related to Apple's Core ML delegation and code under backends/apple/coreml/
Description
🐛 Describe the bug
Models with ReplicationPad3d on Core ML fail to load at runtime.
Repro:
import torch
from executorch.backends.apple.coreml.partition import CoreMLPartitioner
from executorch.exir import to_edge_transform_and_lower, EdgeCompileConfig, to_edge
from executorch.extension.pybindings.portable_lib import _load_for_executorch_from_buffer
class Model(torch.nn.Module):
def __init__(self):
super().__init__()
self.pad = torch.nn.ReplicationPad3d(padding=2)
def forward(self, x):
return self.pad(x)
model = Model()
inputs = (
torch.randn(1, 6, 6, 6, 6),
)
eager_outputs = model(*inputs)
#print(f"Eager: {eager_outputs.shape} {eager_outputs}")
ep = torch.export.export(model.eval(), inputs)
print(ep)
lowered = to_edge_transform_and_lower(
ep,
partitioner=[CoreMLPartitioner()],
compile_config=EdgeCompileConfig(_check_ir_validity=False)
).to_executorch()
print(lowered.exported_program())
et_model = _load_for_executorch_from_buffer(lowered.buffer)
et_outputs = et_model([*inputs])[0]
et_outputs - eager_outputs
Output:
[ETCoreMLModelCompiler.mm:55] [Core ML] Failed to compile model, error = Error Domain=com.apple.mlassetio Code=1 "Failed to parse the model specification. Error: Unable to parse ML Program: in operation aten_pad_default_cast_fp16: Padding for more than two dimensions only supports `$
[backend_delegate.mm:288] [Core ML] Model init failed Failed to compile model, error = Error Domain=com.apple.mlassetio Code=1 "Failed to parse the model specification. Error: Unable to parse ML Program: in operation aten_pad_default_cast_fp16: Padding for more than two dimension$
[coreml_backend_delegate.mm:193] CoreMLBackend: Failed to init the model.
[method.cpp:113] Init failed for backend CoreMLBackend: 0x23
Versions
coremltools version 8.3
executorch commit 67b6009 (Jun 14)
Metadata
Metadata
Assignees
Labels
backend testerThis bug was found by the backend test suite.This bug was found by the backend test suite.module: coremlIssues related to Apple's Core ML delegation and code under backends/apple/coreml/Issues related to Apple's Core ML delegation and code under backends/apple/coreml/
Type
Projects
Status
Backlog
Milestone
Relationships
Development
Select code repository
Activity
[-]Core ML ReplicationPad3d fails to load at runtime[/-][+]CoreML ReplicationPad3d fails to load at runtime[/+]metascroy commentedon Jul 30, 2025
Refiled here: apple/coremltools#2571