Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
exir_ops.edge.aten.copy.default,
exir_ops.edge.aten.tan.default,
exir_ops.edge.aten.index_put.default,
exir_ops.edge.aten.detach_copy.default,
}


Expand Down Expand Up @@ -244,6 +245,7 @@
exir_ops.edge.aten.floor_divide.default,
exir_ops.edge.aten.tan.default,
exir_ops.edge.aten.index_put.default,
exir_ops.edge.aten.detach_copy.default,
}


Expand Down
1 change: 1 addition & 0 deletions backends/arm/operators/ops_identity.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,4 @@ def define_node(


identity_operator_factory("aten.alias_copy.default")
identity_operator_factory("aten.detach_copy.default")
1 change: 1 addition & 0 deletions backends/arm/quantizer/quantization_annotator.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ def _match_pattern(
# That is why we force it to use the same qparams and avoid
# dequant -> neg -> requant chain.
torch.ops.aten.neg.default,
torch.ops.aten.detach_copy.default,
]

_one_to_one_shared_input_or_input_act_qspec = [
Expand Down
56 changes: 56 additions & 0 deletions backends/arm/test/ops/test_detach_copy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Copyright 2026 Arm Limited and/or its affiliates.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

from typing import Tuple

import torch

from executorch.backends.arm.test import common
from executorch.backends.arm.test.tester.test_pipeline import (
TosaPipelineFP,
TosaPipelineINT,
)

input_t1 = Tuple[torch.Tensor]

aten_op = "torch.ops.aten.detach_copy.default"
exir_op = "executorch_exir_dialects_edge__ops_aten__detach_copy_default"

test_data_suite = {
"zeros_2d": torch.zeros(3, 5),
"ones_3d": torch.ones(2, 3, 4),
"rand_2d": torch.rand(10, 10) - 0.5,
"ramp_1d": torch.arange(-8.0, 8.0, 0.5),
}


class DetachCopy(torch.nn.Module):
aten_op = aten_op
exir_op = exir_op

def forward(self, x: torch.Tensor):
return torch.detach_copy(x)


@common.parametrize("test_data", test_data_suite)
def test_detach_tosa_FP(test_data: torch.Tensor):
pipeline = TosaPipelineFP[input_t1](
DetachCopy(),
(test_data,),
aten_op=DetachCopy.aten_op,
exir_op=DetachCopy.exir_op,
)
pipeline.run()


@common.parametrize("test_data", test_data_suite)
def test_detach_tosa_INT(test_data: torch.Tensor):
pipeline = TosaPipelineINT[input_t1](
DetachCopy(),
(test_data,),
aten_op=DetachCopy.aten_op,
exir_op=DetachCopy.exir_op,
)
pipeline.run()
Loading