Skip to content

Commit 00c328e

Browse files
committed
Update on "[executorch][schema] Add 'EXTERNAL' to DataLocation in schema"
To indicate if a tensor is external to the PTE file or not. Currently, we can also use the existence of 'fqn' to determine if a tensor is external or not. I think it's better to have a specific location field as fqn may be required for cases besides external tensor storage. Differential Revision: [D66523171](https://our.internmc.facebook.com/intern/diff/D66523171/) [ghstack-poisoned]
2 parents b05041d + 95278e1 commit 00c328e

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

exir/schema.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class TensorShapeDynamism(IntEnum):
4444

4545

4646
class TensorDataLocation(IntEnum):
47-
CONSTANT_SEGMENT = 0
47+
SEGMENT = 0
4848
EXTERNAL = 1
4949

5050

@@ -56,7 +56,7 @@ class ExtraTensorInfo:
5656

5757
mutable_data_segments_idx: int = 0
5858
fully_qualified_name: Optional[str] = None
59-
location: TensorDataLocation = TensorDataLocation.CONSTANT_SEGMENT
59+
location: TensorDataLocation = TensorDataLocation.SEGMENT
6060

6161

6262
@dataclass

schema/program.fbs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,17 @@ table ExtraTensorInfo {
6767
// [Optional] Specifies the SubsegmentOffsets in
6868
// program.mutable_data_segments that specifies where the data is located in.
6969
// If not present and the data is located in a segment, then the data is in
70-
// the first index.
70+
// index zero.
7171
mutable_data_segments_idx: uint64;
7272

7373
// [Optional] The unique name of the tensor. e.g. 'mod.linear.weight'
7474
fully_qualified_name: string;
7575

76-
// [Optional] Specifies where the tensor is stored; either in the constant segment
77-
// (default case) or an external location. If a constant tensor is stored externally,
78-
// data_buffer_idx is not relevant; use extra_tensor_info.fully_qualified_name to
79-
// match up the external tensor.
76+
// [Optional] Specifies where the tensor's data is stored.
77+
// - SEGMENT (default): Data is stored in a segment.
78+
// - EXTERNAL: Data is stored outside of the PTE file. fully_qualified_name
79+
// must be non-empty, and is used as a key to find the tensor's external
80+
// data. Tensor.data_buffer_idx is ignored.
8081
location: TensorDataLocation;
8182
}
8283

0 commit comments

Comments
 (0)