Answers for "ValueError: Feature (key: age) cannot have rank 0. Given: Tensor("linear/linear_model/Cast:0", shape=(), dtype=float32)"

1

ValueError: Feature (key: age) cannot have rank 0. Given: Tensor("linear/linear_model/Cast:0", shape=(), dtype=float32)

'''Feature cannot have rank 0 issue occurs when we dont specify batch_size 
	with input_fn or eval_fn or predict_fn with estimator api'''
dataset = tf.data.TextLineDataset(data_file)
dataset = dataset.map(parse_csv)
dataset = dataset.batch(10) # or any other batch size
Posted by: Guest on November-04-2020

Code answers related to "ValueError: Feature (key: age) cannot have rank 0. Given: Tensor("linear/linear_model/Cast:0", shape=(), dtype=float32)"

Python Answers by Framework

Browse Popular Code Answers by Language