Skip to content

CoreML ReplicationPad3d fails to load at runtime #11709

@GregoryComer

Description

@GregoryComer
Member

🐛 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)

cc @kimishpatel @YifanShenSZ @cymbalrush @metascroy

Activity

added theissue type on Jun 15, 2025
added
module: coremlIssues related to Apple's Core ML delegation and code under backends/apple/coreml/
backend testerThis bug was found by the backend test suite.
on Jun 15, 2025
changed the title [-]Core ML ReplicationPad3d fails to load at runtime[/-] [+]CoreML ReplicationPad3d fails to load at runtime[/+] on Jun 16, 2025
metascroy

metascroy commented on Jul 30, 2025

@metascroy
Contributor
moved this from To Triage to Backlog in ExecuTorch CoreML backendon Aug 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    backend testerThis bug was found by the backend test suite.module: coremlIssues related to Apple's Core ML delegation and code under backends/apple/coreml/

    Type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @GregoryComer@metascroy

        Issue actions

          CoreML ReplicationPad3d fails to load at runtime · Issue #11709 · pytorch/executorch