Python tensorflow.python.training.training.AdagradOptimizer() Examples
The following are 5
code examples of tensorflow.python.training.training.AdagradOptimizer().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
tensorflow.python.training.training
, or try the search function
.
Example #1
Source File: head.py From auto-alt-text-lambda-api with MIT License | 6 votes |
def _centered_bias_step(centered_bias, logits_dimension, labels, loss_fn): """Creates and returns training op for centered bias.""" if (logits_dimension is None) or (logits_dimension < 1): raise ValueError("Invalid logits_dimension %s." % logits_dimension) with ops.name_scope(None, "centered_bias_step", (labels,)) as name: batch_size = array_ops.shape(labels)[0] logits = array_ops.reshape( array_ops.tile(centered_bias, (batch_size,)), (batch_size, logits_dimension)) with ops.name_scope(None, "centered_bias", (labels, logits)): centered_bias_loss = math_ops.reduce_mean( loss_fn(logits, labels), name="training_loss") # Learn central bias by an optimizer. 0.1 is a convervative lr for a # single variable. return training.AdagradOptimizer(0.1).minimize( centered_bias_loss, var_list=(centered_bias,), name=name)
Example #2
Source File: head.py From keras-lambda with MIT License | 6 votes |
def _centered_bias_step(centered_bias, logits_dimension, labels, loss_fn): """Creates and returns training op for centered bias.""" if (logits_dimension is None) or (logits_dimension < 1): raise ValueError("Invalid logits_dimension %s." % logits_dimension) with ops.name_scope(None, "centered_bias_step", (labels,)) as name: batch_size = array_ops.shape(labels)[0] logits = array_ops.reshape( array_ops.tile(centered_bias, (batch_size,)), (batch_size, logits_dimension)) with ops.name_scope(None, "centered_bias", (labels, logits)): centered_bias_loss = math_ops.reduce_mean( loss_fn(logits, labels), name="training_loss") # Learn central bias by an optimizer. 0.1 is a convervative lr for a # single variable. return training.AdagradOptimizer(0.1).minimize( centered_bias_loss, var_list=(centered_bias,), name=name)
Example #3
Source File: head.py From lambda-packs with MIT License | 5 votes |
def _centered_bias_step(centered_bias, batch_size, labels, loss_fn, weights): """Creates and returns training op for centered bias.""" with ops.name_scope(None, "centered_bias_step", (labels,)) as name: logits_dimension = array_ops.shape(centered_bias)[0] logits = array_ops.reshape( array_ops.tile(centered_bias, (batch_size,)), (batch_size, logits_dimension)) with ops.name_scope(None, "centered_bias", (labels, logits)): centered_bias_loss = math_ops.reduce_mean( loss_fn(labels, logits, weights), name="training_loss") # Learn central bias by an optimizer. 0.1 is a convervative lr for a # single variable. return training.AdagradOptimizer(0.1).minimize( centered_bias_loss, var_list=(centered_bias,), name=name)
Example #4
Source File: dnn.py From deep_image_model with Apache License 2.0 | 5 votes |
def _centered_bias_step(labels, loss_fn, num_label_columns): centered_bias = ops.get_collection(_CENTERED_BIAS) batch_size = array_ops.shape(labels)[0] logits = array_ops.reshape( array_ops.tile(centered_bias[0], [batch_size]), [batch_size, num_label_columns]) loss = loss_fn(logits, labels) return train.AdagradOptimizer(0.1).minimize(loss, var_list=centered_bias)
Example #5
Source File: head.py From deep_image_model with Apache License 2.0 | 5 votes |
def _centered_bias_step(logits_dimension, weight_collection, labels, train_loss_fn): """Creates and returns training op for centered bias.""" centered_bias = ops.get_collection(weight_collection) batch_size = array_ops.shape(labels)[0] logits = array_ops.reshape( array_ops.tile(centered_bias[0], [batch_size]), [batch_size, logits_dimension]) with ops.name_scope(None, "centered_bias", (labels, logits)): centered_bias_loss = math_ops.reduce_mean( train_loss_fn(logits, labels), name="training_loss") # Learn central bias by an optimizer. 0.1 is a convervative lr for a # single variable. return training.AdagradOptimizer(0.1).minimize( centered_bias_loss, var_list=centered_bias)