In order to obtain the usage of T.gt(), i wrote a toy code.
def f(data):
# return T.gt(data, 0)
if T.gt(data, 0):
print "1"
return -data
else:
print "2"
return data
a = T.scalar()
t = f(a)
print t.eval({a:-4})
I expect the returned value is -4 when a=-4 and -4 when a=4, but it always satisfy the condition and run the return -data. I don't know why. Can you help me? thanks for your time.
Aucun commentaire:
Enregistrer un commentaire