e.g. I have a tensor:
import tensorflow.compat.v1 as tf
import numpy as np
a = tf.constant(np.array([[1,2,3,4,5],
[2,2,4,5,6],
[3,4,3,6,7],
[4,5,6,4,8],
[5,6,7,8,5]))
It's symmetric. Now I only want to see the part where abs(i-j)>s, where i, j denote the row and col index, s is a para.
It equals to j - i >s for symmerty.
So if set s = 2, I want to convert a
to:
tf.constant(np.array([[0,0,0,4,5],
[0,0,0,0,6],
[0,0,0,0,0],
[0,0,0,0,0],
[0,0,0,0,0]))
Is there any convince way to do this in tf1.x? TX!