Unable to use canned Tensorflow RNN Estimator

可紊 提交于 2020-01-06 05:45: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

来源:https://stackoverflow.com/questions/56920810/unable-to-use-canned-tensorflow-rnn-estimator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!