close

undefined

使用 Machine learning 方法時會遇到在 Tensorflow 中使用梯度法(Gradient)的情境,以下簡述如何使用 tensorflow 進行梯度法:

 

其中第3行是在建立佔位符 (placeholder),它總共可設置三個參數:

placehoder (dtype, shape, name) Description
dtype 資料型態 (Data type)
shape 張量的維度,None代表允許任何的張量,不過這會有風險
name  

使用時機就是當 tensorflow 需要使用到外部的資料時。

4, 5行就是設計函數,第6, 7行就是使用 Session 來執行這個運算。

 

[Reference]

1. http://www.jianshu.com/p/1bd068d8485f

2. https://morvanzhou.github.io/tutorials/machine-learning/tensorflow/2-5-placeholde/

 

 

arrow
arrow
    全站熱搜

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