Skip to content

Instantly share code, notes, and snippets.

@ispamm
Created November 27, 2018 15:32
Show Gist options
  • Save ispamm/9963c397db1ce9de7ab85aa8251c361c to your computer and use it in GitHub Desktop.
Save ispamm/9963c397db1ce9de7ab85aa8251c361c to your computer and use it in GitHub Desktop.
def single_head_cnn_model_fn(features, labels, mode):
# Extract the features
dense = extract_features(features)
# Predictions
predictions = tf.layers.dense(inputs=dense, units=2)
# Optimizer
optimizer = tf.train.AdamOptimizer()
# Define the head
regression_head = tf.contrib.estimator.regression_head(label_dimension=2)
return regression_head.create_estimator_spec(features, mode, predictions, labels[:, 2:8:5], optimizer)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment