Is there an analog to
numpy.delete where I could just delete a row or column from a 2-mode tensor?
Unlike the following answers that filter by the content of the array
- Removing certain rows from tensor in tensorflow without using tf.RaggedTensor
- How to delete rows in a tensor with tensorflow?
I want to simply delete certain rows and columns by providing indices.
Use the tensorflow
import tensorflow as tf a = tf.constant([1,9,2,8,3,7,4,6,5]) b = tf.boolean_mask(a,tf.greater(5,a)) with tf.Session() as sess: print(sess.run(b)) #[1,2,3,4]