In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail what the mechanism of automatic derivation in tensorflow 2 is, and the content of the article is of high quality, so the editor will share it with you for reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.
Import tensorflow as tf
Import numpy as np
# f (x) = derivative of a*x**2 + biconx + c
X = tf.Variable (0.0, name='x', dtype=tf.float32)
A = tf.constant (1. 0)
B = tf.constant (- 1.5)
C = tf.constant (1.0)
With tf.GradientTape () as tape:
Y = a * tf.pow (xmem2) + b * x + c
Dy_dx = tape.gradient (ymemery x)
Print (dy_dx)
It can be calculated that dy_dx = 2*a*x + b = 2 "1.0" 0.0 + (- 1.5) =-1.5
What we need to know is
(1) how GradienTape traces the function transformation path in the middle of y = a * tf.pow (XMagol 2) + b * x + c.
(2) how to find the derivative of the basic function block.
(3) how to realize the rule of derivation of compound function.
So much for the automatic derivation mechanism in tensorflow 2. I hope the above content can be of some help to you and learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.