def feedforward_layer(self, input_tensor, layer_number):
"""Build a feedforward layer ended with an activation function.
Args:
input_tensor: The output from the layer before.
layer_number (int): The number of the layer in the network.
Returns:
tensor: The activated output.
"""
layer_spec = self.network_spec['layers'][layer_number]
with tf.name_scope('feedforward' + str(layer_number)):
weighted = self._feedforward_step(input_tensor, layer_spec['size'])
activation = getattr(tf.nn, layer_spec['activation_function'])(weighted)
return activation
评论列表
文章目录