Skip to content

Commit fea0bd4

Browse files
larryliu0820facebook-github-bot
authored andcommitted
Add sample input for a subset of core ATen ops (#262)
Summary: Pull Request resolved: #262 Basically move all the sample inputs to functional variants. Then we can generate sample inputs for out variants based on that. This is also aligned with our compiler flow where we lower from core ATen ops to their out variants. Reviewed By: manuelcandales Differential Revision: D49088856 fbshipit-source-id: 71105773bdc07e7e0ca850ef7e79b3af7f1d5fa5
1 parent 6fa0237 commit fea0bd4

File tree

5 files changed

+1342
-0
lines changed

5 files changed

+1342
-0
lines changed

exir/dialects/edge/arg/TARGETS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ oncall("ai_infra_mobile_platform")
55
python_library(
66
name = "lib",
77
srcs = [
8+
"constraints.py",
89
"model.py",
910
"type.py",
1011
],

exir/dialects/edge/arg/constraints.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Copyright (c) Meta Platforms, Inc. and affiliates.
2+
# All rights reserved.
3+
#
4+
# This source code is licensed under the BSD-style license found in the
5+
# LICENSE file in the root directory of this source tree.
6+
7+
8+
def scatter_add_index_size_max(x, dim, src, d):
9+
max_d = src.size(d)
10+
if d != dim:
11+
max_d = min(max_d, x.size(d))
12+
return max_d

exir/dialects/edge/arg/model.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,8 @@ def to_out(self, *, name: Optional[str] = None) -> OutArg:
359359
fill=self.fill,
360360
size=self.size,
361361
dtype=self.dtype,
362+
value=self.value,
363+
deps=self.deps,
362364
)
363365

364366

exir/dialects/edge/op/TARGETS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ python_library(
77
name = "lib",
88
srcs = [
99
"api.py",
10+
"sample_input.py",
1011
],
1112
deps = [
1213
"//caffe2:torch",
1314
"//caffe2/torchgen:torchgen",
15+
"//executorch/exir/dialects/edge/arg:lib",
1416
"//executorch/exir/operator:convert",
1517
],
1618
)

0 commit comments

Comments
 (0)