【发布时间】:2019-07-14 06:27:10
【问题描述】:
我有一个神经网络,输入两个参数:
t = tf.placeholder(tf.float32, [None, 1])
x = tf.placeholder(tf.float32, [None, 1])
在我的损失函数中,我需要在t 上对输出进行积分,但我无法找到这样做的方法,因为 TensorFlow 中唯一可用的数值积分函数 tf.contrib.integrate.odeint_fixed 不能将张量作为函数,因为它不能被调用:
呼叫
t = tf.constant(np.linspace(0.0,1.0,100), dtype = tf.float64 )
integ = tf.contrib.integrate.odeint_fixed(model.output,
0.0,
t,
method = "rk4")
输出
...
<ipython-input-5-c79e79b75391> in loss(model, t, x)
24 0.0,
25 t,
---> 26 method = "rk4")
...
TypeError: 'Tensor' object is not callable
更不用说我也不知道如何在这个计算中处理x,它应该是固定的。
【问题讨论】:
标签: python tensorflow neural-network numerical-methods