Apply a tensorflow operation to tensor indexes

  python-3.x, tensorflow1.15

I have a tensor which is a like a 2D matrix with every sublist having 4 floats. This is a sample output:

[[-57.993378  16.389141 282.08826  335.57178 ]
 [331.8664   251.26202  467.9576   420.6745  ]
 [331.85397   59.201126 467.94247  228.73703 ]]

I want to apply tf.math.minimum to first two elements of every sublist and tf.math.maximum to the last two. I am not sure how to use tensorflow ops to achieve that

I am using tensorflow1.15

Source: Python-3x Questions

LEAVE A COMMENT