close

Tensorflow 中的 Tensor 代表的就是矩陣,而矩陣轉成 Tensor 後進行運算,是沒辦法使用 print 指令輸出,只能先透過 Session 執行才會有結果,舉例如下:

 

 

接著輸出的結果就會是這樣

matrix1 & matrix2 
[[2 2 2]
 [2 2 2]
 [2 2 2]]
[[1 1 1]
 [1 1 1]
 [1 1 1]]
2017-11-15 13:07:27.808383: I C:\tf_jenkins\home\workspace\rel-win\M\windows\PY\35\tensorflow\core\platform\cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX
===透過Session輸出===
[[6 6 6]
 [6 6 6]
 [6 6 6]]
===直接用print輸出===
Tensor("MatMul:0", shape=(3, 3), dtype=int32)

Process finished with exit code 0

 

 

arrow
arrow
    全站熱搜

    葛瑞斯肯 發表在 痞客邦 留言(0) 人氣()