November 2017
Intermediate to advanced
274 pages
6h 16m
English
First, we initialize the class variables and weights:
self.num_input = num_input self.num_hidden = num_hidden self.transfer = transfer_function network_weights = self._initialize_weights() self.weights = network_weights
Here, the _initialize_weigths() function is a local function that initializes values for the weights dictionary:
The following code shows how weights are initialized as a dictionary of TensorFlow variables for two hidden layers:
def _initialize_weights(self): weights = dict() weights['w1'] = tf.get_variable("w1"
Read now
Unlock full access