書名: TensorFlow 2.0 Quick Start Guide作者名: Tony Holdroyd本章字?jǐn)?shù): 66字更新時(shí)間: 2021-06-24 16:02:05
Finding the mean across columns
Find the mean across columns (that is, reduce rows) with this:
tf.reduce_mean(input_tensor=numbers, axis=0) # [ (4. + 7. )/2 , (5. + 3.)/2 ] = [5.5, 4.]
The output will be as follows:
<tf.Tensor: id=61, shape=(2,), dtype=float32, numpy=array([5.5, 4. ], dtype=float32)>
When keepdims is True, the reduced axis is retained with a length of 1:
tf.reduce_mean(input_tensor=numbers, axis=0, keepdims=True)
The output is as follows:
array([[5.5, 4.]]) (1 row, 2 columns)
推薦閱讀
- 現(xiàn)代測控系統(tǒng)典型應(yīng)用實(shí)例
- Introduction to DevOps with Kubernetes
- 網(wǎng)絡(luò)服務(wù)器架設(shè)(Windows Server+Linux Server)
- 機(jī)器自動(dòng)化控制器原理與應(yīng)用
- 大數(shù)據(jù)安全與隱私保護(hù)
- 西門子S7-200 SMART PLC實(shí)例指導(dǎo)學(xué)與用
- Android游戲開發(fā)案例與關(guān)鍵技術(shù)
- 計(jì)算機(jī)網(wǎng)絡(luò)原理與技術(shù)
- ESP8266 Home Automation Projects
- Lightning Fast Animation in Element 3D
- R Data Analysis Projects
- Cloud Security Automation
- Excel 2010函數(shù)與公式速查手冊(cè)
- 數(shù)據(jù)要素:全球經(jīng)濟(jì)社會(huì)發(fā)展的新動(dòng)力
- 貫通Java Web輕量級(jí)應(yīng)用開發(fā)