diff options
author | Rohan Jain <rohanj@google.com> | 2018-09-18 19:39:27 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-09-18 19:43:44 -0700 |
commit | 9fe177881224571aff0c267593f747f5fd7a2967 (patch) | |
tree | 9c5051a7336ac9832171ebfee8e610ba550d0f1e /tensorflow/contrib/estimator | |
parent | 9ee75bb6e29007b8b5ea4a6d981996d8a4d88373 (diff) |
Getting DNNModel to work with the new feature columns.
PiperOrigin-RevId: 213561495
Diffstat (limited to 'tensorflow/contrib/estimator')
-rw-r--r-- | tensorflow/contrib/estimator/python/estimator/dnn_with_layer_annotations.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/tensorflow/contrib/estimator/python/estimator/dnn_with_layer_annotations.py b/tensorflow/contrib/estimator/python/estimator/dnn_with_layer_annotations.py index 152431d1b2..a8eeff6f6d 100644 --- a/tensorflow/contrib/estimator/python/estimator/dnn_with_layer_annotations.py +++ b/tensorflow/contrib/estimator/python/estimator/dnn_with_layer_annotations.py @@ -76,6 +76,7 @@ def make_input_layer_with_layer_annotations(original_input_layer, mode): weight_collections=None, trainable=True, cols_to_vars=None, + scope=None, cols_to_output_tensors=None): """Returns a dense `Tensor` as input layer based on given `feature_columns`. @@ -112,6 +113,7 @@ def make_input_layer_with_layer_annotations(original_input_layer, mode): 'some_variable:0' shape=(5, 10), <tf.Variable 'some_variable:1' shape=(5, 10)]} If a column creates no variables, its value will be an empty list. + scope: A name or variable scope to use cols_to_output_tensors: If not `None`, must be a dictionary that will be filled with a mapping from '_FeatureColumn' to the associated output `Tensor`s. @@ -132,6 +134,7 @@ def make_input_layer_with_layer_annotations(original_input_layer, mode): weight_collections=weight_collections, trainable=trainable, cols_to_vars=cols_to_vars, + scope=scope, cols_to_output_tensors=local_cols_to_output_tensors) if cols_to_output_tensors is not None: @@ -301,9 +304,9 @@ def DNNClassifierWithLayerAnnotations( # pylint: disable=invalid-name def _model_fn(features, labels, mode, config): with _monkey_patch( - feature_column_lib, 'input_layer', - make_input_layer_with_layer_annotations(feature_column_lib.input_layer, - mode)): + feature_column_lib, '_internal_input_layer', + make_input_layer_with_layer_annotations( + feature_column_lib._internal_input_layer, mode)): # pylint: disable=protected-access return original.model_fn(features, labels, mode, config) return estimator.Estimator( @@ -422,9 +425,9 @@ def DNNRegressorWithLayerAnnotations( # pylint: disable=invalid-name def _model_fn(features, labels, mode, config): with _monkey_patch( - feature_column_lib, 'input_layer', - make_input_layer_with_layer_annotations(feature_column_lib.input_layer, - mode)): + feature_column_lib, '_internal_input_layer', + make_input_layer_with_layer_annotations( + feature_column_lib._internal_input_layer, mode)): # pylint: disable=protected-access return original.model_fn(features, labels, mode, config) return estimator.Estimator( |