@@ -64,110 +64,8 @@ int32_t aoti_torch_layout_strided() {
6464 return 0 ;
6565}
6666
67- // ============================================================
68- // Storage & Device Property Getters - Implementations
69- // ============================================================
70-
71- AOTITorchError aoti_torch_get_storage_offset (
72- Tensor* tensor,
73- int64_t * ret_storage_offset) {
74- if (tensor == nullptr || ret_storage_offset == nullptr ) {
75- return Error::InvalidArgument;
76- }
77- *ret_storage_offset = tensor->storage_offset ();
78- return Error::Ok;
79- }
80-
81- AOTITorchError aoti_torch_get_storage_size (Tensor* tensor, int64_t * ret_size) {
82- if (tensor == nullptr || ret_size == nullptr ) {
83- return Error::InvalidArgument;
84- }
85- *ret_size = static_cast <int64_t >(tensor->storage ()->nbytes ());
86- return Error::Ok;
87- }
88-
89- AOTITorchError aoti_torch_get_device_type (
90- Tensor* tensor,
91- int32_t * ret_device_type) {
92- if (tensor == nullptr || ret_device_type == nullptr ) {
93- return Error::InvalidArgument;
94- }
95- *ret_device_type = static_cast <int32_t >(tensor->device_type ());
96- return Error::Ok;
97- }
98-
99- AOTITorchError aoti_torch_get_device_index (
100- Tensor* tensor,
101- int32_t * ret_device_index) {
102- if (tensor == nullptr || ret_device_index == nullptr ) {
103- return Error::InvalidArgument;
104- }
105- *ret_device_index = static_cast <int32_t >(tensor->device_index ());
106- return Error::Ok;
107- }
108-
109- // ============================================================
110- // DType Constants - Implementations
111- // ============================================================
112-
113- int32_t aoti_torch_dtype_float32 () {
114- return 6 ; // ScalarType::Float
115- }
116-
117- int32_t aoti_torch_dtype_bfloat16 () {
118- return 15 ; // ScalarType::BFloat16
119- }
120-
121- int32_t aoti_torch_dtype_int64 () {
122- return 4 ; // ScalarType::Long
123- }
124-
125- int32_t aoti_torch_dtype_int32 () {
126- return 3 ; // ScalarType::Int
127- }
128-
129- int32_t aoti_torch_dtype_int16 () {
130- return 2 ; // ScalarType::Short
131- }
132-
133- int32_t aoti_torch_dtype_int8 () {
134- return 1 ; // ScalarType::Char
135- }
136-
137- int32_t aoti_torch_dtype_bool () {
138- return 11 ; // ScalarType::Bool
139- }
140-
141- // ============================================================
142- // Device Type Constants - Implementations
143- // ============================================================
144-
145- int32_t aoti_torch_device_type_cpu () {
146- return 0 ; // DeviceType::CPU
147- }
148-
149- int32_t aoti_torch_device_type_cuda () {
150- return 1 ; // DeviceType::CUDA
151- }
152-
153- // ============================================================
154- // Grad Mode Functions - Implementations
155- // ============================================================
156-
157- bool aoti_torch_grad_mode_is_enabled () {
158- // ExecuTorch doesn't support autograd
159- return false ;
160- }
161-
162- AOTITorchError aoti_torch_grad_mode_set_enabled (bool enabled) {
163- if (enabled) {
164- // ExecuTorch doesn't support autograd
165- return Error::NotSupported;
166- }
167- return Error::Ok;
168- }
169-
17067} // extern "C"
68+
17169} // namespace aoti
17270} // namespace backends
17371} // namespace executorch
0 commit comments