- TensorFlow 2.0 Quick Start Guide
- Tony Holdroyd
- 87字
- 2021-06-24 16:02:05
Finding the squared difference between two tensors
Later in this book, we will need to find the square of the difference between two tensors. The method is as follows:
tf.math.squared.difference( x, y, name=None)
Take the following example:
x = [1,3,5,7,11]
y = 5
s = tf.math.squared_difference(x,y)
s
The output will be as follows:
<tf.Tensor: id=279, shape=(5,), dtype=int32, numpy=array([16, 4, 0, 4, 36], dtype=int32)>
Note that the Python variables, x and y, are cast into tensors and that y is then broadcast across x in this example. So, for example, the first calculation is (1-5)2 = 16.
推薦閱讀
- Mastering VMware vSphere 6.5
- 2018西門子工業(yè)專家會議論文集(上)
- Arduino &樂高創(chuàng)意機器人制作教程
- 網(wǎng)絡化分布式系統(tǒng)預測控制
- Excel 2010函數(shù)與公式速查手冊
- Hands-On Dashboard Development with QlikView
- AVR單片機工程師是怎樣煉成的
- 生成對抗網(wǎng)絡項目實戰(zhàn)
- 人工智能:智能人機交互
- 計算智能算法及其生產(chǎn)調(diào)度應用
- Flash CS5二維動畫設計與制作
- 大話數(shù)據(jù)科學:大數(shù)據(jù)與機器學習實戰(zhàn)(基于R語言)
- Arduino創(chuàng)意機器人入門:基于ArduBlock(第2版)
- AVR單片機C語言程序設計實例精粹
- 這樣用Word!