tensorflow框架
生活随笔
收集整理的這篇文章主要介紹了
tensorflow框架
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
- 張量(tensor):多維數組(列表)? ? ? ? ? 階:張量的維數;
?
| 0-D | 0 | 標量 scalar | s=1 2 31 |
| 1-D | 1 | 向量 vector | v=[1,2,3] |
| 2-D | 2 | 矩陣 matrix | m=[[1,2,3],[4,5,6],[7,8,9]] |
| n-D | n | 張量 tensor | t=[[.....? |
?
?
?
?
?
?
- ? 數據類型: tf.float32 tf.in32? ...
- import tensorflow as tfa=tf.constant([1.0,2.0])
b=tf.constant([3.0,4.0])result=a+b
print(result)
結果:Tensor("add_5:0", shape=(2,), dtype=float32)
-
add_5:0 節點名:第0個輸出 shape=(2,) 維度:一維數組,長度2 dtype=float32 數據類型 -
tf.constant():表示定義常量;
-
計算圖(Graph):搭建神經網絡計算過程,只搭建,不運算。
-
y=XW
? =x1*w1+x2*w2 - import tensorflow as tfx=tf.constant([[1.0,2.0]])
w=tf.constant([[3.0],[4.0]])y=tf.matmul(x,w)
print(y)with tf.Session() as sess:print(sess.run(y))
Tensor("MatMul:0", shape=(1, 1), dtype=float32)
? -
會話(Session):執行計算圖中的節點運算。
- with tf.Session() as sess:print(sess.run(y))
?
?
?
總結
以上是生活随笔為你收集整理的tensorflow框架的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Leetcode--621. 任务调度器
- 下一篇: jsp内置对象--application