首页
登录 | 注册

tensorflow 二阶导数计算

import tensorflow as tf

x = tf.constant(1,tf.float32)
y = tf.nn.relu(x)
dy = tf.gradients(y,x)
ddy = tf.gradients(dy,x)
with tf.Session() as sess:
    print sess.run(y)
    print sess.run(dy)
    print sess.run(ddy)


2020 jeepxie.net webmaster#jeepxie.net
10 q. 0.009 s.
京ICP备10005923号