- TensorFlow 2.0 Quick Start Guide
- Tony Holdroyd
- 67字
- 2021-06-24 16:02:05
Finding the mean across rows
Find the mean across rows (that is, reduce columns) with this:
tf.reduce_mean(input_tensor=numbers, axis=1) # [ (4. + 5. )/2 , (7. + 3. )/2] = [4.5, 5]
The output will be as follows:
<tf.Tensor: id=64, shape=(2,), dtype=float32, numpy=array([4.5, 5. ], dtype=float32)>
When keepdims is True, the reduced axis is retained with a length of 1:
tf.reduce_mean(input_tensor=numbers, axis=1, keepdims=True)
The output is as follows:
([[4.5], [5]]) (2 rows, 1 column)
推薦閱讀
- Google Cloud Platform Cookbook
- 手把手教你玩轉(zhuǎn)RPA:基于UiPath和Blue Prism
- 輕松學(xué)Java
- IoT Penetration Testing Cookbook
- 機(jī)艙監(jiān)測與主機(jī)遙控
- Visual C++編程全能詞典
- ESP8266 Home Automation Projects
- Prometheus監(jiān)控實(shí)戰(zhàn)
- Chef:Powerful Infrastructure Automation
- DevOps Bootcamp
- RedHat Linux用戶基礎(chǔ)
- 從零開始學(xué)PHP
- Flink原理與實(shí)踐
- 30天學(xué)通Java Web項目案例開發(fā)
- Windows 7故障與技巧200例