【发布时间】:2018-01-12 05:24:02
【问题描述】:
我遇到一个错误,代码如下。我想检查功能层的梯度,出现错误:
import numpy as np
import tensorflow as tf
def floor(x):
return tf.floor(x)
# code
w1 = tf.Variable([[1.5, 0.5, -0.5, -1.5]])
res = floor(w1)
grads = tf.gradients(res, [w1])
with tf.Session() as sess:
tf.global_variables_initializer().run()
print(sess.run(grads))
【问题讨论】:
标签: python tensorflow gradient floor