fork download
  1. import tensorflow as tf
  2. import numpy as np
  3.  
  4. a = np.array([[[1, 1.2, 1.3], [2, 2.2, 2.3], [7, 7.2, 7.3]],
  5. [[3, 3.2, 3.3], [4, 4.2, 4.3], [8, 8.2, 8.3]],
  6. [[5, 5.2, 5.3], [6, 6.2, 6.3], [9, 9.2, 9.3]]])
  7.  
  8. with tf.Session() as sess:
  9. product = tf.strided_slice(a, [0, 2, 0], [3, 0, 3], [1, -1, 2])
  10. print(product.eval())
Success #stdin #stdout 1.03s 200580KB
stdin
Standard input is empty
stdout
[[[7.  7.3]
  [2.  2.3]]

 [[8.  8.3]
  [4.  4.3]]

 [[9.  9.3]
  [6.  6.3]]]