You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- array dimensions as either a tuple or a custom shape object. If a shape object, the object must be immutable and must support indexing for dimension retrieval.
287
+
- array dimensions. An array dimension must be `None` if and only if a dimension is unknown.
290
288
291
-
_TODO: need to more carefully consider this in order to accommodate, e.g., graph tensors where a shape may be dynamic._
289
+
```{note}
290
+
For array libraries having graph-based computational models, array dimensions may be unknown due to data-dependent operations (e.g., boolean indexing; `A[:, B > 0]`) and thus cannot be statically resolved without knowing array contents.
291
+
```
292
+
293
+
```{note}
294
+
The returned value should be a tuple; however, where warranted, an array library may choose to return a custom shape object. If an array library returns a custom shape object, the object must be immutable, must support indexing for dimension retrieval, and must behave similarly to a tuple.
295
+
```
292
296
293
297
(attribute-size)=
294
298
### size
295
299
296
-
Number of elements in an array. This must equal the product of the array's dimensions.
300
+
Number of elements in an array.
301
+
302
+
```{note}
303
+
This must equal the product of the array's dimensions.
304
+
```
297
305
298
306
#### Returns
299
307
300
-
-**out**: _int_
308
+
-**out**: _Optional\[ int ]_
301
309
302
-
- number of elements in an array.
310
+
- number of elements in an array. The returned value must be `None` if and only if one or more array dimensions are unknown.
303
311
304
-
_TODO: need to more carefully consider this in order to accommodate, e.g., graph tensors where the number of elements may be dynamic._
312
+
```{note}
313
+
For array libraries having graph-based computational models, an array may have unknown dimensions due to data-dependent operations.
314
+
```
305
315
306
316
(attribute-T)=
307
317
### T
@@ -783,11 +793,6 @@ Computes the truth value of `self_i <= other_i` for each element of an array ins
783
793
Element-wise results must equal the results returned by the equivalent element-wise function [`less_equal(x1, x2)`](elementwise_functions.md#less_equalx1-x2-).
784
794
```
785
795
786
-
(method-__len__)=
787
-
### \_\_len\_\_(self, /)
788
-
789
-
_TODO: need to more carefully consider this in order to accommodate, e.g., graph tensors where a shape may be dynamic. Furthermore, not clear whether this should be implemented, as, e.g., NumPy's behavior of returning the size of the first dimension is not necessarily intuitive, as opposed to, say, the total number of elements._
0 commit comments