parameters: (features, labels, mode)
return_statement: return tf.estimator.EstimatorSpec(
        mode, loss=loss, eval_metric_ops=eval_metric_ops)
docstring: DNN with three hidden layers, and dropout of 0.1 probability.
docstring_summary: DNN with three hidden layers, and dropout of 0.1 probability.
docstring_tokens: DNN with three hidden layers and dropout of 0 . 1 probability .
function: def my_model(features, labels, mode):
    """DNN with three hidden layers, and dropout of 0.1 probability."""
    # Create three fully connected layers respectively of size 10, 20, and 10 with
    # each layer having a dropout probability of 0.1.
    net = features[X_FEATURE]
    for units in [10, 20, 10]:
      net = tf.layers.dense(net, units=units, activation=tf.nn.relu)
      net = tf.layers.dropout(net, rate=0.1)
  
    # Compute logits (1 per class).
    logits = tf.layers.dense(net, 3, activation=None)
  
    # Compute predictions.
    predicted_classes = tf.argmax(logits, 1)
    if mode == tf.estimator.ModeKeys.PREDICT:
      predictions = {
          'class': predicted_classes,
          'prob': tf.nn.softmax(logits)
      }
      return tf.estimator.EstimatorSpec(mode, predictions=predictions)
  
    # Compute loss.
    loss = tf.losses.sparse_softmax_cross_entropy(labels=labels, logits=logits)
  
    # Create training op.
    if mode == tf.estimator.ModeKeys.TRAIN:
      optimizer = tf.train.AdagradOptimizer(learning_rate=0.1)
      train_op = optimizer.minimize(loss, global_step=tf.train.get_global_step())
      return tf.estimator.EstimatorSpec(mode, loss=loss, train_op=train_op)
  
    # Compute evaluation metrics.
    eval_metric_ops = {
        'accuracy': tf.metrics.accuracy(
            labels=labels, predictions=predicted_classes)
    }
    return tf.estimator.EstimatorSpec(
        mode, loss=loss, eval_metric_ops=eval_metric_ops)
function_tokens: def my_model ( features , labels , mode ) : # Create three fully connected layers respectively of size 10, 20, and 10 with # each layer having a dropout probability of 0.1. net = features [ X_FEATURE ] for units in [ 10 , 20 , 10 ] : net = tf . layers . dense ( net , units = units , activation = tf . nn . relu ) net = tf . layers . dropout ( net , rate = 0.1 ) # Compute logits (1 per class). logits = tf . layers . dense ( net , 3 , activation = None ) # Compute predictions. predicted_classes = tf . argmax ( logits , 1 ) if mode == tf . estimator . ModeKeys . PREDICT : predictions = { 'class' : predicted_classes , 'prob' : tf . nn . softmax ( logits ) } return tf . estimator . EstimatorSpec ( mode , predictions = predictions ) # Compute loss. loss = tf . losses . sparse_softmax_cross_entropy ( labels = labels , logits = logits ) # Create training op. if mode == tf . estimator . ModeKeys . TRAIN : optimizer = tf . train . AdagradOptimizer ( learning_rate = 0.1 ) train_op = optimizer . minimize ( loss , global_step = tf . train . get_global_step ( ) ) return tf . estimator . EstimatorSpec ( mode , loss = loss , train_op = train_op ) # Compute evaluation metrics. eval_metric_ops = { 'accuracy' : tf . metrics . accuracy ( labels = labels , predictions = predicted_classes ) } return tf . estimator . EstimatorSpec ( mode , loss = loss , eval_metric_ops = eval_metric_ops )