@@ -26,8 +26,8 @@ struct evalue_to_const_ref_overload_return {
2626};
2727
2828template <>
29- struct evalue_to_const_ref_overload_return <exec_aten ::Tensor> {
30- using type = const exec_aten ::Tensor&;
29+ struct evalue_to_const_ref_overload_return <executorch::aten ::Tensor> {
30+ using type = const executorch::aten ::Tensor&;
3131};
3232
3333template <typename T>
@@ -36,8 +36,8 @@ struct evalue_to_ref_overload_return {
3636};
3737
3838template <>
39- struct evalue_to_ref_overload_return <exec_aten ::Tensor> {
40- using type = exec_aten ::Tensor&;
39+ struct evalue_to_ref_overload_return <executorch::aten ::Tensor> {
40+ using type = executorch::aten ::Tensor&;
4141};
4242
4343} // namespace internal
@@ -67,18 +67,19 @@ class BoxedEvalueList {
6767 /*
6868 * Constructs and returns the list of T specified by the EValue pointers
6969 */
70- exec_aten ::ArrayRef<T> get () const ;
70+ executorch::aten ::ArrayRef<T> get () const ;
7171
7272 private:
7373 // Source of truth for the list
74- exec_aten ::ArrayRef<EValue*> wrapped_vals_;
74+ executorch::aten ::ArrayRef<EValue*> wrapped_vals_;
7575 // Same size as wrapped_vals
7676 mutable T* unwrapped_vals_;
7777};
7878
7979template <>
80- exec_aten::ArrayRef<exec_aten::optional<exec_aten::Tensor>>
81- BoxedEvalueList<exec_aten::optional<exec_aten::Tensor>>::get() const ;
80+ executorch::aten::ArrayRef<executorch::aten::optional<executorch::aten::Tensor>>
81+ BoxedEvalueList<executorch::aten::optional<executorch::aten::Tensor>>::get()
82+ const ;
8283
8384// Aggregate typing system similar to IValue only slimmed down with less
8485// functionality, no dependencies on atomic, and fewer supported types to better
@@ -96,18 +97,18 @@ struct EValue {
9697 bool as_bool;
9798 // TODO(jakeszwe): convert back to pointers to optimize size of this
9899 // struct
99- exec_aten ::ArrayRef<char > as_string;
100- exec_aten ::ArrayRef<double > as_double_list;
101- exec_aten ::ArrayRef<bool > as_bool_list;
100+ executorch::aten ::ArrayRef<char > as_string;
101+ executorch::aten ::ArrayRef<double > as_double_list;
102+ executorch::aten ::ArrayRef<bool > as_bool_list;
102103 BoxedEvalueList<int64_t > as_int_list;
103- BoxedEvalueList<exec_aten ::Tensor> as_tensor_list;
104- BoxedEvalueList<exec_aten:: optional<exec_aten ::Tensor>>
104+ BoxedEvalueList<executorch::aten ::Tensor> as_tensor_list;
105+ BoxedEvalueList<executorch::aten:: optional<executorch::aten ::Tensor>>
105106 as_list_optional_tensor;
106107 } copyable_union;
107108
108109 // Since a Tensor just holds a TensorImpl*, there's no value to use Tensor*
109110 // here.
110- exec_aten ::Tensor as_tensor;
111+ executorch::aten ::Tensor as_tensor;
111112
112113 Payload () {}
113114 ~Payload () {}
@@ -197,7 +198,7 @@ struct EValue {
197198
198199 /* ***** Scalar Type ******/
199200 // / Construct an EValue using the implicit value of a Scalar.
200- /* implicit*/ EValue(exec_aten ::Scalar s) {
201+ /* implicit*/ EValue(executorch::aten ::Scalar s) {
201202 if (s.isIntegral (false )) {
202203 tag = Tag::Int;
203204 payload.copyable_union .as_int = s.to <int64_t >();
@@ -216,7 +217,7 @@ struct EValue {
216217 return tag == Tag::Int || tag == Tag::Double || tag == Tag::Bool;
217218 }
218219
219- exec_aten ::Scalar toScalar () const {
220+ executorch::aten ::Scalar toScalar () const {
220221 // Convert from implicit value to Scalar using implicit constructors.
221222
222223 if (isDouble ()) {
@@ -231,11 +232,11 @@ struct EValue {
231232 }
232233
233234 /* ***** Tensor Type ******/
234- /* implicit*/ EValue(exec_aten ::Tensor t) : tag(Tag::Tensor) {
235+ /* implicit*/ EValue(executorch::aten ::Tensor t) : tag(Tag::Tensor) {
235236 // When built in aten mode, at::Tensor has a non trivial constructor
236237 // destructor, so regular assignment to a union field is UB. Instead we must
237238 // go through placement new (which causes a refcount bump).
238- new (&payload.as_tensor ) exec_aten ::Tensor (t);
239+ new (&payload.as_tensor ) executorch::aten ::Tensor (t);
239240 }
240241
241242 // Template constructor that allows construction from types that can be
@@ -261,35 +262,36 @@ struct EValue {
261262 return tag == Tag::Tensor;
262263 }
263264
264- exec_aten ::Tensor toTensor () && {
265+ executorch::aten ::Tensor toTensor () && {
265266 ET_CHECK_MSG (isTensor (), " EValue is not a Tensor." );
266267 auto res = std::move (payload.as_tensor );
267268 clearToNone ();
268269 return res;
269270 }
270271
271- exec_aten ::Tensor& toTensor () & {
272+ executorch::aten ::Tensor& toTensor () & {
272273 ET_CHECK_MSG (isTensor (), " EValue is not a Tensor." );
273274 return payload.as_tensor ;
274275 }
275276
276- const exec_aten ::Tensor& toTensor () const & {
277+ const executorch::aten ::Tensor& toTensor () const & {
277278 ET_CHECK_MSG (isTensor (), " EValue is not a Tensor." );
278279 return payload.as_tensor ;
279280 }
280281
281282 /* ***** String Type ******/
282283 /* implicit*/ EValue(const char * s, size_t size) : tag(Tag::String) {
283- payload.copyable_union .as_string = exec_aten::ArrayRef<char >(s, size);
284+ payload.copyable_union .as_string =
285+ executorch::aten::ArrayRef<char >(s, size);
284286 }
285287
286288 bool isString () const {
287289 return tag == Tag::String;
288290 }
289291
290- exec_aten ::string_view toString () const {
292+ executorch::aten ::string_view toString () const {
291293 ET_CHECK_MSG (isString (), " EValue is not a String." );
292- return exec_aten ::string_view (
294+ return executorch::aten ::string_view (
293295 payload.copyable_union .as_string .data (),
294296 payload.copyable_union .as_string .size ());
295297 }
@@ -303,41 +305,42 @@ struct EValue {
303305 return tag == Tag::ListInt;
304306 }
305307
306- exec_aten ::ArrayRef<int64_t > toIntList () const {
308+ executorch::aten ::ArrayRef<int64_t > toIntList () const {
307309 ET_CHECK_MSG (isIntList (), " EValue is not an Int List." );
308310 return payload.copyable_union .as_int_list .get ();
309311 }
310312
311313 /* ***** Bool List Type ******/
312- /* implicit*/ EValue(exec_aten ::ArrayRef<bool > b) : tag(Tag::ListBool) {
314+ /* implicit*/ EValue(executorch::aten ::ArrayRef<bool > b) : tag(Tag::ListBool) {
313315 payload.copyable_union .as_bool_list = b;
314316 }
315317
316318 bool isBoolList () const {
317319 return tag == Tag::ListBool;
318320 }
319321
320- exec_aten ::ArrayRef<bool > toBoolList () const {
322+ executorch::aten ::ArrayRef<bool > toBoolList () const {
321323 ET_CHECK_MSG (isBoolList (), " EValue is not a Bool List." );
322324 return payload.copyable_union .as_bool_list ;
323325 }
324326
325327 /* ***** Double List Type ******/
326- /* implicit*/ EValue(exec_aten::ArrayRef<double > d) : tag(Tag::ListDouble) {
328+ /* implicit*/ EValue(executorch::aten::ArrayRef<double > d)
329+ : tag(Tag::ListDouble) {
327330 payload.copyable_union .as_double_list = d;
328331 }
329332
330333 bool isDoubleList () const {
331334 return tag == Tag::ListDouble;
332335 }
333336
334- exec_aten ::ArrayRef<double > toDoubleList () const {
337+ executorch::aten ::ArrayRef<double > toDoubleList () const {
335338 ET_CHECK_MSG (isDoubleList (), " EValue is not a Double List." );
336339 return payload.copyable_union .as_double_list ;
337340 }
338341
339342 /* ***** Tensor List Type ******/
340- /* implicit*/ EValue(BoxedEvalueList<exec_aten ::Tensor> t)
343+ /* implicit*/ EValue(BoxedEvalueList<executorch::aten ::Tensor> t)
341344 : tag(Tag::ListTensor) {
342345 payload.copyable_union .as_tensor_list = t;
343346 }
@@ -346,13 +349,14 @@ struct EValue {
346349 return tag == Tag::ListTensor;
347350 }
348351
349- exec_aten:: ArrayRef<exec_aten ::Tensor> toTensorList () const {
352+ executorch::aten:: ArrayRef<executorch::aten ::Tensor> toTensorList () const {
350353 ET_CHECK_MSG (isTensorList (), " EValue is not a Tensor List." );
351354 return payload.copyable_union .as_tensor_list .get ();
352355 }
353356
354357 /* ***** List Optional Tensor Type ******/
355- /* implicit*/ EValue(BoxedEvalueList<exec_aten::optional<exec_aten::Tensor>> t)
358+ /* implicit*/ EValue(
359+ BoxedEvalueList<executorch::aten::optional<executorch::aten::Tensor>> t)
356360 : tag(Tag::ListOptionalTensor) {
357361 payload.copyable_union .as_list_optional_tensor = t;
358362 }
@@ -361,34 +365,39 @@ struct EValue {
361365 return tag == Tag::ListOptionalTensor;
362366 }
363367
364- exec_aten::ArrayRef<exec_aten::optional<exec_aten::Tensor>>
368+ executorch::aten::ArrayRef<
369+ executorch::aten::optional<executorch::aten::Tensor>>
365370 toListOptionalTensor () const {
366371 return payload.copyable_union .as_list_optional_tensor .get ();
367372 }
368373
369374 /* ***** ScalarType Type ******/
370- exec_aten ::ScalarType toScalarType () const {
375+ executorch::aten ::ScalarType toScalarType () const {
371376 ET_CHECK_MSG (isInt (), " EValue is not a ScalarType." );
372- return static_cast <exec_aten::ScalarType>(payload.copyable_union .as_int );
377+ return static_cast <executorch::aten::ScalarType>(
378+ payload.copyable_union .as_int );
373379 }
374380
375381 /* ***** MemoryFormat Type ******/
376- exec_aten ::MemoryFormat toMemoryFormat () const {
382+ executorch::aten ::MemoryFormat toMemoryFormat () const {
377383 ET_CHECK_MSG (isInt (), " EValue is not a MemoryFormat." );
378- return static_cast <exec_aten::MemoryFormat>(payload.copyable_union .as_int );
384+ return static_cast <executorch::aten::MemoryFormat>(
385+ payload.copyable_union .as_int );
379386 }
380387
381388 /* ***** Layout Type ******/
382- exec_aten ::Layout toLayout () const {
389+ executorch::aten ::Layout toLayout () const {
383390 ET_CHECK_MSG (isInt (), " EValue is not a Layout." );
384- return static_cast <exec_aten ::Layout>(payload.copyable_union .as_int );
391+ return static_cast <executorch::aten ::Layout>(payload.copyable_union .as_int );
385392 }
386393
387394 /* ***** Device Type ******/
388- exec_aten ::Device toDevice () const {
395+ executorch::aten ::Device toDevice () const {
389396 ET_CHECK_MSG (isInt (), " EValue is not a Device." );
390- return exec_aten::Device (
391- static_cast <exec_aten::DeviceType>(payload.copyable_union .as_int ), -1 );
397+ return executorch::aten::Device (
398+ static_cast <executorch::aten::DeviceType>(
399+ payload.copyable_union .as_int ),
400+ -1 );
392401 }
393402
394403 template <typename T>
@@ -403,9 +412,9 @@ struct EValue {
403412 * an uninitialized state.
404413 */
405414 template <typename T>
406- inline exec_aten ::optional<T> toOptional () const {
415+ inline executorch::aten ::optional<T> toOptional () const {
407416 if (this ->isNone ()) {
408- return exec_aten ::nullopt ;
417+ return executorch::aten ::nullopt ;
409418 }
410419 return this ->to <T>();
411420 }
@@ -421,7 +430,7 @@ struct EValue {
421430 void moveFrom (EValue&& rhs) noexcept {
422431 if (rhs.isTensor ()) {
423432 new (&payload.as_tensor )
424- exec_aten ::Tensor (std::move (rhs.payload .as_tensor ));
433+ executorch::aten ::Tensor (std::move (rhs.payload .as_tensor ));
425434 rhs.payload .as_tensor .~Tensor ();
426435 } else {
427436 payload.copyable_union = rhs.payload .copyable_union ;
@@ -451,7 +460,7 @@ struct EValue {
451460
452461 EValue (const Payload& p, Tag t) : tag(t) {
453462 if (isTensor ()) {
454- new (&payload.as_tensor ) exec_aten ::Tensor (p.as_tensor );
463+ new (&payload.as_tensor ) executorch::aten ::Tensor (p.as_tensor );
455464 } else {
456465 payload.copyable_union = p.copyable_union ;
457466 }
@@ -480,60 +489,64 @@ struct EValue {
480489 return static_cast <return_type>(this ->method_name ()); \
481490 }
482491
483- EVALUE_DEFINE_TO (exec_aten ::Scalar, toScalar)
492+ EVALUE_DEFINE_TO (executorch::aten ::Scalar, toScalar)
484493EVALUE_DEFINE_TO (int64_t , toInt)
485494EVALUE_DEFINE_TO (bool , toBool)
486495EVALUE_DEFINE_TO (double , toDouble)
487- EVALUE_DEFINE_TO (exec_aten ::string_view, toString)
488- EVALUE_DEFINE_TO (exec_aten ::ScalarType, toScalarType)
489- EVALUE_DEFINE_TO (exec_aten ::MemoryFormat, toMemoryFormat)
490- EVALUE_DEFINE_TO (exec_aten ::Layout, toLayout)
491- EVALUE_DEFINE_TO (exec_aten ::Device, toDevice)
496+ EVALUE_DEFINE_TO (executorch::aten ::string_view, toString)
497+ EVALUE_DEFINE_TO (executorch::aten ::ScalarType, toScalarType)
498+ EVALUE_DEFINE_TO (executorch::aten ::MemoryFormat, toMemoryFormat)
499+ EVALUE_DEFINE_TO (executorch::aten ::Layout, toLayout)
500+ EVALUE_DEFINE_TO (executorch::aten ::Device, toDevice)
492501// Tensor and Optional Tensor
493502EVALUE_DEFINE_TO (
494- exec_aten:: optional<exec_aten ::Tensor>,
495- toOptional<exec_aten ::Tensor>)
496- EVALUE_DEFINE_TO (exec_aten ::Tensor, toTensor)
503+ executorch::aten:: optional<executorch::aten ::Tensor>,
504+ toOptional<executorch::aten ::Tensor>)
505+ EVALUE_DEFINE_TO (executorch::aten ::Tensor, toTensor)
497506
498507// IntList and Optional IntList
499- EVALUE_DEFINE_TO (exec_aten ::ArrayRef<int64_t >, toIntList)
508+ EVALUE_DEFINE_TO (executorch::aten ::ArrayRef<int64_t >, toIntList)
500509EVALUE_DEFINE_TO (
501- exec_aten:: optional<exec_aten ::ArrayRef<int64_t >>,
502- toOptional<exec_aten ::ArrayRef<int64_t >>)
510+ executorch::aten:: optional<executorch::aten ::ArrayRef<int64_t >>,
511+ toOptional<executorch::aten ::ArrayRef<int64_t >>)
503512
504513// DoubleList and Optional DoubleList
505- EVALUE_DEFINE_TO (exec_aten ::ArrayRef<double >, toDoubleList)
514+ EVALUE_DEFINE_TO (executorch::aten ::ArrayRef<double >, toDoubleList)
506515EVALUE_DEFINE_TO (
507- exec_aten:: optional<exec_aten ::ArrayRef<double >>,
508- toOptional<exec_aten ::ArrayRef<double >>)
516+ executorch::aten:: optional<executorch::aten ::ArrayRef<double >>,
517+ toOptional<executorch::aten ::ArrayRef<double >>)
509518
510519// BoolList and Optional BoolList
511- EVALUE_DEFINE_TO (exec_aten ::ArrayRef<bool >, toBoolList)
520+ EVALUE_DEFINE_TO (executorch::aten ::ArrayRef<bool >, toBoolList)
512521EVALUE_DEFINE_TO (
513- exec_aten:: optional<exec_aten ::ArrayRef<bool >>,
514- toOptional<exec_aten ::ArrayRef<bool >>)
522+ executorch::aten:: optional<executorch::aten ::ArrayRef<bool >>,
523+ toOptional<executorch::aten ::ArrayRef<bool >>)
515524
516525// TensorList and Optional TensorList
517- EVALUE_DEFINE_TO (exec_aten::ArrayRef<exec_aten::Tensor>, toTensorList)
518526EVALUE_DEFINE_TO (
519- exec_aten::optional<exec_aten::ArrayRef<exec_aten::Tensor>>,
520- toOptional<exec_aten::ArrayRef<exec_aten::Tensor>>)
527+ executorch::aten::ArrayRef<executorch::aten::Tensor>,
528+ toTensorList)
529+ EVALUE_DEFINE_TO (
530+ executorch::aten::optional<
531+ executorch::aten::ArrayRef<executorch::aten::Tensor>>,
532+ toOptional<executorch::aten::ArrayRef<executorch::aten::Tensor>>)
521533
522534// List of Optional Tensor
523535EVALUE_DEFINE_TO (
524- exec_aten::ArrayRef<exec_aten::optional<exec_aten::Tensor>>,
536+ executorch::aten::ArrayRef<
537+ executorch::aten::optional<executorch::aten::Tensor>>,
525538 toListOptionalTensor)
526539#undef EVALUE_DEFINE_TO
527540
528541template <typename T>
529- exec_aten ::ArrayRef<T> BoxedEvalueList<T>::get() const {
530- for (typename exec_aten ::ArrayRef<T>::size_type i = 0 ;
542+ executorch::aten ::ArrayRef<T> BoxedEvalueList<T>::get() const {
543+ for (typename executorch::aten ::ArrayRef<T>::size_type i = 0 ;
531544 i < wrapped_vals_.size ();
532545 i++) {
533546 ET_CHECK (wrapped_vals_[i] != nullptr );
534547 unwrapped_vals_[i] = wrapped_vals_[i]->template to <T>();
535548 }
536- return exec_aten ::ArrayRef<T>{unwrapped_vals_, wrapped_vals_.size ()};
549+ return executorch::aten ::ArrayRef<T>{unwrapped_vals_, wrapped_vals_.size ()};
537550}
538551
539552} // namespace runtime
0 commit comments