I am using theano.clip to limit values of my numpy array. For e.g.
array = np.array([[ 1., -1., -3., 1., 1.],
[ 3., -4., -5., 0., -1.],
[ 8., -3., -7., -3., -3.],
[ 8., 2., -2., -3., -3.],
[ 7., 0., 0., 1., 0.]])
max_val = np.array([2.0]).astype('float32')
T.clip(array, -max_val, max_val).eval()
Output:
array([[ 1., -1., -2., 1., 1.],
[ 2., -2., -2., 0., -1.],
[ 2., -2., -2., -2., -2.],
[ 2., 2., -2., -2., -2.],
[ 2., 0., 0., 1., 0.]])
I want to calculate how many values were clipped after the clipping operation. Is it possible?