I have the following code
#feats is a tensorflow tensor with shape [1,13,13,255]
x = feats[..., :2]
so what are these three dots doing? I know that in the second dimension we only take the values of 0 and 1.
I have the following code
#feats is a tensorflow tensor with shape [1,13,13,255]
x = feats[..., :2]
so what are these three dots doing? I know that in the second dimension we only take the values of 0 and 1.
This is from SciPy Cookbook Indexing
:
The ellipsis (three dots) indicates "as many ':' as needed". (Its name for use in index-fiddling code is Ellipsis, and it's not numpy-specific.) This makes it easy to manipulate only one dimension of an array, letting numpy do array-wise operations over the "unwanted" dimensions. You can only really have one ellipsis in any given indexing expression, or else the expression would be ambiguous about how many ':' should be put in each. (In fact, for some reason it is allowed to have something like "C[...,...]"; this is not actually ambiguous.)