tensorflow: how to select rows of matrix with condition -
i find similar solutions here. however, solution makes binary selection between 2 matrices based on 1 condition. need select rows satisfy condition. how can achieve this?
i briefly introduce question here. example :
tf.interactivesession() yt = tf.constant([10,1,10]) = tf.constant([1,2,3]) b = tf.constant([3,4,5]) tf.where(tf.less(yt,[5]), a, b).eval()
the result choose value a
if associated yt
value less 5, , otherwise choose value b
. need select value a
if yt<5
, , otherwise not choose anything.
how can achieve this?
thank you!
you can do:
a[tf.squeeze(tf.where(tf.less(yt,[5]), none, none))
Comments
Post a Comment