You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
for feature_name in CATEGORICAL_COLUMNS:
sample_dict[feature_name] = tf.expand_dims(sample_dict[feature_name], -1)
for feature_name in CONTINUOUS_COLUMNS:
**sample_dict[feature_name] = tf.constant(sample_dict[feature_name], dtype=tf.int32)** # I think here is the problem .. But i don't know how to resolve it ..
print(sample_dict)
return sample_dict
Using TensorFlow version 1.4.0
TensorFlow version 1.4.0
Begin training and evaluation
Saving model checkpoints to models/model_WIDE_AND_DEEP_1510910853
estimator built
2017-11-17 14:57:41.105234: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX
fit done
evaluate done
Accuracy: 0.7945
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/layers/python/layers/feature_column_ops.py", line 143, in _input_from_feature_columns
output_rank=output_rank))
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/layers/python/layers/feature_column.py", line 1828, in _to_dnn_input_layer
return _reshape_real_valued_tensor(input_tensor, output_rank, self.name)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/layers/python/layers/feature_column.py", line 1606, in _reshape_real_valued_tensor
raise ValueError(error_string)
ValueError: Error while processing column I1.Rank of input Tensor (0) should be the same as output_rank (2). For example, sequence data should typically be 3 dimensional (rank 3) while non-sequence data is typically 2 dimensional (rank 2).
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "task.py", line 320, in
train_and_eval(args.job_dir)
File "task.py", line 263, in train_and_eval
ans = m.predict(input_fn=pred_fn)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/util/deprecation.py", line 381, in new_func
return func(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/util/deprecation.py", line 381, in new_func
return func(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined.py", line 736, in predict
as_iterable=as_iterable)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/util/deprecation.py", line 381, in new_func
return func(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined.py", line 771, in predict_classes
as_iterable=as_iterable)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/util/deprecation.py", line 316, in new_func
return func(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 615, in predict
as_iterable=as_iterable)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 913, in _infer_model
infer_ops = self._get_predict_ops(features)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 1252, in _get_predict_ops
return self._call_model_fn(features, labels, model_fn_lib.ModeKeys.INFER)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 1166, in _call_model_fn
model_fn_results = self._model_fn(features, labels, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined.py", line 242, in _dnn_linear_combined_model_fn
scope=dnn_input_scope)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/layers/python/layers/feature_column_ops.py", line 212, in input_from_feature_columns
default_name='input_from_feature_columns')
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/layers/python/layers/feature_column_ops.py", line 146, in _input_from_feature_columns
'{}, {}'.format(column.name, e, ee)) ValueError: Error creating input layer for column: I1.
Error while processing column I1.Rank of input Tensor (0) should be the same as output_rank (2). For example, sequence data should typically be 3 dimensional (rank 3) while non-sequence data is typically 2 dimensional (rank 2)., No deep embedding lookup arguments for column _RealValuedColumn(column_name='I1', dimension=1, default_value=None, dtype=tf.float32, normalizer=None).
From the error i can understand one thing the input rank is scalar but it should be a matrix .. Correct me if i'm wrong and i'm a newbie here in tensorflow
The text was updated successfully, but these errors were encountered:
ok, I find change the sample_dict[feature_name] = tf.constant(sample_dict[feature_name], dtype=tf.int32)
to sample_dict[feature_name] = tf.expand_dims(tf.constant(sample_dict[feature_name], dtype=tf.int32), -1)
I receive the following error while executing m.predict()
The code associated with m.predict(input_fn=pred_fn) :
def pred_fn():
sample = [ 1, 127, 1, 3, 1683, 19, 26, 17, 475, 0, 9, 0, 3, "05db9164", "8947f767", "11c9d79e", "52a787c8", "4cf72387", "fbad5c96", "18671b18", "0b153874", "a73ee510", "ceb10289", "77212bd7", "79507c6b", "7203f04e", "07d13a8f", "2c14c412", "49013ffe", "8efede7f", "bd17c3da", "f6a3e43b", "a458ea53", "35cd95c9", "ad3062eb", "c7dc6720", "3fdb382b", "010f6491", "49d68486"]
sample_dict = dict(zip(FEATURE_COLUMNS, sample))
Using TensorFlow version 1.4.0
TensorFlow version 1.4.0
Begin training and evaluation
Saving model checkpoints to models/model_WIDE_AND_DEEP_1510910853
estimator built
2017-11-17 14:57:41.105234: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX
fit done
evaluate done
Accuracy: 0.7945
{'I12': <tf.Tensor 'Const_11:0' shape=() dtype=int32>, 'C12': <tf.Tensor 'ExpandDims_11:0' shape=(1,) dtype=string>, 'I4': <tf.Tensor 'Const_3:0' shape=() dtype=int32>, 'I9': <tf.Tensor 'Const_8:0' shape=() dtype=int32>, 'C20': <tf.Tensor 'ExpandDims_19:0' shape=(1,) dtype=string>, 'C25': <tf.Tensor 'ExpandDims_24:0' shape=(1,) dtype=string>, 'C6': <tf.Tensor 'ExpandDims_5:0' shape=(1,) dtype=string>, 'C17': <tf.Tensor 'ExpandDims_16:0' shape=(1,) dtype=string>, 'C4': <tf.Tensor 'ExpandDims_3:0' shape=(1,) dtype=string>, 'I1': <tf.Tensor 'Const:0' shape=() dtype=int32>, 'I8': <tf.Tensor 'Const_7:0' shape=() dtype=int32>, 'I3': <tf.Tensor 'Const_2:0' shape=() dtype=int32>, 'C26': <tf.Tensor 'ExpandDims_25:0' shape=(1,) dtype=string>, 'C5': <tf.Tensor 'ExpandDims_4:0' shape=(1,) dtype=string>, 'C24': <tf.Tensor 'ExpandDims_23:0' shape=(1,) dtype=string>, 'I7': <tf.Tensor 'Const_6:0' shape=() dtype=int32>, 'C16': <tf.Tensor 'ExpandDims_15:0' shape=(1,) dtype=string>, 'C19': <tf.Tensor 'ExpandDims_18:0' shape=(1,) dtype=string>, 'C18': <tf.Tensor 'ExpandDims_17:0' shape=(1,) dtype=string>, 'I11': <tf.Tensor 'Const_10:0' shape=() dtype=int32>, 'C23': <tf.Tensor 'ExpandDims_22:0' shape=(1,) dtype=string>, 'I5': <tf.Tensor 'Const_4:0' shape=() dtype=int32>, 'C14': <tf.Tensor 'ExpandDims_13:0' shape=(1,) dtype=string>, 'I6': <tf.Tensor 'Const_5:0' shape=() dtype=int32>, 'C10': <tf.Tensor 'ExpandDims_9:0' shape=(1,) dtype=string>, 'C21': <tf.Tensor 'ExpandDims_20:0' shape=(1,) dtype=string>, 'C3': <tf.Tensor 'ExpandDims_2:0' shape=(1,) dtype=string>, 'C7': <tf.Tensor 'ExpandDims_6:0' shape=(1,) dtype=string>, 'C15': <tf.Tensor 'ExpandDims_14:0' shape=(1,) dtype=string>, 'C2': <tf.Tensor 'ExpandDims_1:0' shape=(1,) dtype=string>, 'I2': <tf.Tensor 'Const_1:0' shape=() dtype=int32>, 'C11': <tf.Tensor 'ExpandDims_10:0' shape=(1,) dtype=string>, 'C8': <tf.Tensor 'ExpandDims_7:0' shape=(1,) dtype=string>, 'C9': <tf.Tensor 'ExpandDims_8:0' shape=(1,) dtype=string>, 'C13': <tf.Tensor 'ExpandDims_12:0' shape=(1,) dtype=string>, 'C1': <tf.Tensor 'ExpandDims:0' shape=(1,) dtype=string>, 'I13': <tf.Tensor 'Const_12:0' shape=() dtype=int32>, 'I10': <tf.Tensor 'Const_9:0' shape=() dtype=int32>, 'C22': <tf.Tensor 'ExpandDims_21:0' shape=(1,) dtype=string>}
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/layers/python/layers/feature_column_ops.py", line 127, in _input_from_feature_columns
transformed_tensor)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/layers/python/layers/feature_column.py", line 256, in _deep_embedding_lookup_arguments
"No deep embedding lookup arguments for column {}.".format(self))
NotImplementedError: No deep embedding lookup arguments for column _RealValuedColumn(column_name='I1', dimension=1, default_value=None, dtype=tf.float32, normalizer=None).
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/layers/python/layers/feature_column_ops.py", line 143, in _input_from_feature_columns
output_rank=output_rank))
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/layers/python/layers/feature_column.py", line 1828, in _to_dnn_input_layer
return _reshape_real_valued_tensor(input_tensor, output_rank, self.name)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/layers/python/layers/feature_column.py", line 1606, in _reshape_real_valued_tensor
raise ValueError(error_string)
ValueError: Error while processing column I1.Rank of input Tensor (0) should be the same as output_rank (2). For example, sequence data should typically be 3 dimensional (rank 3) while non-sequence data is typically 2 dimensional (rank 2).
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "task.py", line 320, in
train_and_eval(args.job_dir)
File "task.py", line 263, in train_and_eval
ans = m.predict(input_fn=pred_fn)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/util/deprecation.py", line 381, in new_func
return func(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/util/deprecation.py", line 381, in new_func
return func(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined.py", line 736, in predict
as_iterable=as_iterable)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/util/deprecation.py", line 381, in new_func
return func(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined.py", line 771, in predict_classes
as_iterable=as_iterable)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/util/deprecation.py", line 316, in new_func
return func(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 615, in predict
as_iterable=as_iterable)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 913, in _infer_model
infer_ops = self._get_predict_ops(features)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 1252, in _get_predict_ops
return self._call_model_fn(features, labels, model_fn_lib.ModeKeys.INFER)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 1166, in _call_model_fn
model_fn_results = self._model_fn(features, labels, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined.py", line 242, in _dnn_linear_combined_model_fn
scope=dnn_input_scope)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/layers/python/layers/feature_column_ops.py", line 212, in input_from_feature_columns
default_name='input_from_feature_columns')
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/layers/python/layers/feature_column_ops.py", line 146, in _input_from_feature_columns
'{}, {}'.format(column.name, e, ee))
ValueError: Error creating input layer for column: I1.
Error while processing column I1.Rank of input Tensor (0) should be the same as output_rank (2). For example, sequence data should typically be 3 dimensional (rank 3) while non-sequence data is typically 2 dimensional (rank 2)., No deep embedding lookup arguments for column _RealValuedColumn(column_name='I1', dimension=1, default_value=None, dtype=tf.float32, normalizer=None).
From the error i can understand one thing the input rank is scalar but it should be a matrix .. Correct me if i'm wrong and i'm a newbie here in tensorflow
The text was updated successfully, but these errors were encountered: