10
10
11
11
#include < array>
12
12
#include < cstddef>
13
+ #include < cstdint>
13
14
#include < limits>
14
15
15
- #include < executorch/runtime/core/exec_aten/exec_aten.h>
16
- #include < executorch/runtime/core/exec_aten/util/tensor_util.h>
16
+ #include < executorch/runtime/core/exec_aten/util/tensor_dimension_limit.h>
17
17
#include < executorch/runtime/core/span.h>
18
18
19
19
namespace executorch ::runtime {
@@ -34,18 +34,35 @@ constexpr size_t kTensorShapeStringSizeLimit = 1 + /* opening parenthesis */
34
34
35
35
namespace internal {
36
36
constexpr size_t kMaximumPrintableTensorShapeElement =
37
- std::is_same_v<executorch::aten::SizesType, int32_t >
38
- ? std::numeric_limits<int32_t >::max()
39
- : std::numeric_limits<uint32_t >::max();
37
+ std::numeric_limits<int32_t >::max();
40
38
} // namespace internal
41
39
42
40
/* *
43
41
* Convert a shape to a NUL-terminated C string with limited size. If
44
42
* elements of the shape are larger than
45
43
* kMaximumPrintableTensorShapeElement, those elements will be
46
44
* rendered as ERR instead.
45
+ *
46
+ * NOTE: There are two overloads of this function to support both ATen
47
+ * tensors and ExecuTorch Tensors, which have different SizesType,
48
+ * while also avoiding a dependency on exec_aten.h from this header
49
+ * because that would cause a circular dependency.
50
+ */
51
+ std::array<char , kTensorShapeStringSizeLimit > tensor_shape_to_c_string (
52
+ executorch::runtime::Span<const std::int32_t > shape);
53
+
54
+ /* *
55
+ * Convert a shape to a NUL-terminated C string with limited size. If
56
+ * elements of the shape are larger than
57
+ * kMaximumPrintableTensorShapeElement, those elements will be
58
+ * rendered as ERR instead.
59
+ *
60
+ * NOTE: There are two overloads of this function to support both ATen
61
+ * tensors and ExecuTorch Tensors, which have different SizesType,
62
+ * while also avoiding a dependency on exec_aten.h from this header
63
+ * because that would cause a circular dependency.
47
64
*/
48
65
std::array<char , kTensorShapeStringSizeLimit > tensor_shape_to_c_string (
49
- executorch::runtime::Span<const executorch::aten::SizesType > shape);
66
+ executorch::runtime::Span<const std:: int64_t > shape);
50
67
51
68
} // namespace executorch::runtime
0 commit comments