我使用tf.contrib.layers.fully_connected
在下面的代碼中創建一個圖層。如何從tf.contrib.layers.fully_connected創建的圖層訪問權重?
library(tensorflow)
x <- tf$placeholder(tf$float32, shape(NULL, 784L))
logits <- tf$contrib$layers$fully_connected(x, 10L)
y <- tf$nn$softmax(logits)
如何訪問權,我會在下面的代碼塊與sess$run(W)
?
x <- tf$placeholder(tf$float32, shape(NULL, 784L))
W <- tf$Variable(tf$zeros(shape(784L, 10L)))
b <- tf$Variable(tf$zeros(shape(10L)))
y <- tf$nn$softmax(tf$matmul(x, W) + b)
注:我使用TensorFlow對R但這應該通過改變$
爲.
是一樣的TensorFlow爲Python。