问题
Why do I get dataset not initialized error in Tensorflow 2.3 where there is no longer a concept of session?
import tensorflow as tf
print(tf.__version__)
bm = tf.estimator.BaselineRegressor(
model_dir=None, label_dimension=1, weight_column=None, optimizer='Ftrl',
)
def create_dummy_data():
d = tf.data.Dataset.from_generator(lambda:
iter(
({'osName': b'Android OS', 'osVersion': b'5.1.1',
'deviceModel': b'dfjhgsdjhfshfjsgdjhf'}, 100),
...
),
output_types=({
"osName": tf.string,
"osVersion": tf.string,
"deviceModel": tf.string
}, tf.int32))
return d
# input_fns = DataInputFns()
bm.train(
create_dummy_data,
steps=6
)
Pasted the entire code at https://colab.research.google.com/drive/1HlZ0NLbu5tZu0HfQvvPIrDx6Um2WVRLc?usp=sharing
来源:https://stackoverflow.com/questions/64094061/failedpreconditionerror-getnext-failed-because-the-iterator-has-not-been-init