Skip to content

Commit 843b3d2

Browse files
committed
more clean up
1 parent 45eee87 commit 843b3d2

File tree

2 files changed

+0
-59
lines changed

2 files changed

+0
-59
lines changed

exir/emit/_emitter.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,29 +1185,6 @@ def _emit_control_flow(
11851185
"""
11861186
specs = self.node.meta["spec"]
11871187

1188-
# For map and scan operations, the stacked output tensors are built up
1189-
# incrementally via et_copy_index. These tensors need to be marked as
1190-
# DYNAMIC_BOUND to allow resizing during execution, even if their shape
1191-
# appears static.
1192-
if target is torch.ops.higher_order.map_impl:
1193-
# Map stacks all outputs, so all output specs need DYNAMIC_BOUND
1194-
def mark_dynamic_bounded(spec: TensorSpec) -> TensorSpec:
1195-
spec.shape_dynamism = TensorShapeDynamism.DYNAMIC_BOUND
1196-
return spec
1197-
1198-
specs = pytree.tree_map(mark_dynamic_bounded, specs)
1199-
1200-
elif target is torch.ops.higher_order.scan:
1201-
# Scan has (carry_outputs, y_outputs). Only y_outputs are stacked
1202-
# and need DYNAMIC_BOUND. carry_outputs keep their original dynamism.
1203-
init = args[1]
1204-
num_carry = len(init) if isinstance(init, (list, tuple)) else 1
1205-
1206-
flat_specs, spec_tree = pytree.tree_flatten(specs)
1207-
for i in range(num_carry, len(flat_specs)):
1208-
flat_specs[i].shape_dynamism = TensorShapeDynamism.DYNAMIC_BOUND
1209-
specs = pytree.tree_unflatten(flat_specs, spec_tree)
1210-
12111188
subemitter_binding_output_values = pytree.tree_map(
12121189
lambda spec: self._emit_spec(spec),
12131190
specs,

kernels/prim_ops/test/prim_ops_test.cpp

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -281,42 +281,6 @@ TEST_F(RegisterPrimOpsTest, TestETCopyIndexMismatchShape) {
281281
getOpsFn("executorch_prim::et_copy_index.tensor")(context_, stack));
282282
}
283283

284-
TEST_F(RegisterPrimOpsTest, TestETCopyIndexStaticShape) {
285-
int64_t index = 1;
286-
testing::TensorFactory<ScalarType::Int> tf;
287-
288-
EValue values[3];
289-
EValue* stack[3];
290-
291-
// Test with static shape tensors.
292-
const std::vector<int> buf = {1, 2, 3, 4};
293-
auto copy_to = tf.make({2, 2}, buf);
294-
auto to_copy = tf.make({2}, {5, 6});
295-
296-
values[0] = EValue(copy_to);
297-
values[1] = EValue(to_copy);
298-
values[2] = EValue(index);
299-
300-
stack[0] = &values[0];
301-
stack[1] = &values[1];
302-
stack[2] = &values[2];
303-
304-
// Copy and replace at index 1.
305-
getOpsFn("executorch_prim::et_copy_index.tensor")(context_, stack);
306-
EXPECT_EQ(copy_to.sizes()[0], 2);
307-
EXPECT_EQ(copy_to.sizes()[1], 2);
308-
EXPECT_TENSOR_EQ(copy_to, tf.make({2, 2}, {1, 2, 5, 6}));
309-
310-
#ifndef USE_ATEN_LIB
311-
// Copy and replace at index 2. This should trigger an EXPECT
312-
// in lean mode.
313-
index = 2;
314-
values[2] = EValue(index);
315-
ET_EXPECT_DEATH(
316-
getOpsFn("executorch_prim::et_copy_index.tensor")(context_, stack), "");
317-
#endif
318-
}
319-
320284
TEST_F(RegisterPrimOpsTest, TestBooleanOps) {
321285
EValue values[3];
322286
double a = 3;

0 commit comments

Comments
 (0)