This section provides the steps to set up the visible and hidden layers of an RBM using TensorFlow:
- Start a new interactive TensorFlow session:
# Reset the graph
tf$reset_default_graph()
# Starting session as interactive session
sess <- tf$InteractiveSession()
- Define the model parameters. The num_input parameter defines the number of nodes in the visible layer and num_hidden defines the number of nodes in the hidden layer:
num_input<-784L
num_hidden<-900L
- Create a placeholder variable for the weight matrix:
W <- tf$placeholder(tf$float32, shape = shape(num_input, num_hidden))
- Create placeholder variables of the visible and hidden biases:
vb <- tf$placeholder(tf$float32, shape = shape(num_input))
hb <- tf$placeholder(tf$float32, shape = shape(num_hidden))