Unable to use canned Tensorflow RNN Estimator

2019-08-16 01:06发布

I am trying to use the canned RNN Estimator from Tensorflow as follows:

import tensorflow as tf

sequence_feature_colums = [tf.contrib.feature_column.sequence_numeric_column("test")]

estimator = tf.contrib.estimator.RNNEstimator(
    head=tf.contrib.estimator.regression_head(),
    sequence_feature_columns=sequence_feature_colums)

def input_fn_train():
  dataset = tf.data.Dataset.from_tensor_slices(({"test": [0]}, [0]))
  dataset = dataset.batch(1)
  return dataset

estimator.train(input_fn=input_fn_train, steps=1)

but I am getting the error TypeError: Input must be a SparseTensor.

This feels like a bug to me, or am I using it wrong?

tensorflow==1.14.0

EDIT: I have created an issue - https://github.com/tensorflow/tensorflow/issues/30456

0条回答
登录 后发表回答