Suppose I have the following numpy array:
array = np.array([[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],[1, 2, 3, 4, 5, 6, 7, 8, 9, 10],[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
,[1, 2, 3, 4, 5, 6, 7, 8, 9, 10],[1, 2, 3, 4, 5, 6, 7, 8, 9, 10],[1, 2, 3, 4, 5, 6, 7, 8, 9, 10],[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
,[1, 2, 3, 4, 5, 6, 7, 8, 9, 10],[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]], np.int32)
Then if I use slicing I get:
array[1:5,1:5]
array([[2, 3, 4, 5],
[2, 3, 4, 5],
[2, 3, 4, 5],
[2, 3, 4, 5]], dtype=int32)
I want the similar results, if I want to select rows and columns that have "gaps"(for example 1,3 and 5).
So I want select rows and columns 1,3,5 and get:
array([[2, 4, 6],
[2, 4, 6],
[2, 4, 6]], dtype=int32)
But I don't know how to do it.
I want to do the same in tensorflow 2.0 but tf.gather
doesnt' help
EDIT: Slicing doesn't solve the problem, when there is no patter in rows and columns numbers