Allow one tensor to be the input to the estimator.

PiperOrigin-RevId: 163747076
This commit is contained in:
A. Unique TensorFlower 2017-07-31 14:19:15 -07:00 committed by TensorFlower Gardener
parent 104f349e9e
commit 1333e77450
2 changed files with 5 additions and 5 deletions

View File

@ -68,6 +68,9 @@ def model_builder(features, labels, mode, params, config):
center_bias = params["center_bias"]
if isinstance(features, ops.Tensor):
features = {features.name: features}
# Make a shallow copy of features to ensure downstream usage
# is unaffected by modifications in the model function.
training_features = copy.copy(features)

View File

@ -142,7 +142,7 @@ def extract_features(features, feature_columns):
"""Extracts columns from a dictionary of features.
Args:
features: `Tensor` or `dict` of `Tensor` objects.
features: `dict` of `Tensor` objects.
feature_columns: A list of feature_columns.
Returns:
@ -161,9 +161,6 @@ def extract_features(features, feature_columns):
if not features:
raise ValueError("Features dictionary must be specified.")
if isinstance(features, ops.Tensor):
features = {features.name, features}
# Make a shallow copy of features to ensure downstream usage
# is unaffected by modifications in the model function.
features = copy.copy(features)
@ -277,7 +274,7 @@ class GradientBoostedDecisionTreeModel(object):
examples based on the depth of the layer that's being built.
learner_config: A learner config.
print split, sorted_feature_names[split.feature_column]
features: `Tensor` or `dict` of `Tensor` objects.
features: `dict` of `Tensor` objects.
feature_columns: A list of feature columns.
Raises: