title: PrefetchDataset' object has no attribute 'ndim'
body: <p>I am using below code to predict next word using GRU.</p>
  <pre><code>import numpy as np
  shakespeare_url = &quot;https://homl.info/shakespeare&quot;
  filepath = keras.utils.get_file(&quot;shakespeare.txt&quot;,shakespeare_urlspeare_url)
  
  with open(filepath) as f:
      shakespeare_txt = f.read()
      
  tokenizer = keras.preprocessing.text.Tokenizer(char_level=True)
  tokenizer.fit_on_texts(shakespeare_txt)
  max_id = len(tokenizer.word_index) ## Number of distinct words
  dataset_size = tokenizer.document_count ## total number of character
  [encoded] = np.array(tokenizer.texts_to_sequences([shakespeare_txt])) - 1
  train_size = (dataset_size * 90) // 100
  dataset = tf.data.Dataset.from_tensor_slices(encoded[:train_size])
  n_steps = 100
  window_length = n_steps +1
  dataset = dataset.window(window_length,shift=1,drop_remainder=True)
  dataset = dataset.flat_map(lambda window : window.batch(window_length))
  batch_size =32
  dataset = dataset.shuffle(10000).batch(batch_size)
  dataset = dataset.map(lambda windows : (windows[:,:-1],windows[:,1:]))
  dataset = dataset.map(lambda X_batch,Y_batch : (tf.one_hot(X_batch,depth = max_id),Y_batch))
  dataset = dataset.prefetch(1)
  model = keras.models.Sequential([
      keras.layers.GRU(128, return_sequences=True, input_shape =[None,max_id], dropout=0.2,recurrent_dropout=0.2),
      keras.layers.GRU(128,return_sequences=True,dropout=0.2,recurrent_dropout=0.2),
      keras.layers.TimeDistributed(keras.layers.Dense(max_id,activation='softmax'))
  ])
  model.compile(loss='sparse_categorical_crossentropy',optimizer='adam')
  history = model.fit(dataset,epochs=20)
  </code></pre>
  <p>Getting below Exception. Please help me to resolve this issue??</p>
  <p>AttributeError                            Traceback (most recent call last)
   in 
  ----&gt; 1 history = model.fit(dataset,epochs=20)</p>
  <p>c:\users\dixit\appdata\local\programs\python\python38\lib\site-packages\keras\engine\training.py in fit(self, x, y, batch_size, epochs, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, initial_epoch, steps_per_epoch, validation_steps, validation_freq, max_queue_size, workers, use_multiprocessing, **kwargs)
  1148
  1149         # Case 2: Symbolic tensors or Numpy array-like.
  -&gt; 1150         x, y, sample_weights = self._standardize_user_data(
  1151             x, y,
  1152             sample_weight=sample_weight,</p>
  <p>c:\users\dixit\appdata\local\programs\python\python38\lib\site-packages\keras\engine\training.py in _standardize_user_data(self, x, y, sample_weight, class_weight, check_array_lengths, batch_size)
  572
  573         # Standardize the inputs.
  --&gt; 574         x = training_utils.standardize_input_data(
  575             x,
  576             feed_input_names,</p>
  <p>c:\users\dixit\appdata\local\programs\python\python38\lib\site-packages\keras\engine\training_utils.py in standardize_input_data(data, names, shapes, check_batch_axis, exception_prefix)
  97         data = data.values if data.<strong>class</strong>.<strong>name</strong> == 'DataFrame' else data
  98         data = [data]
  ---&gt; 99     data = [standardize_single_array(x) for x in data]
  100
  101     if len(data) != len(names):</p>
  <p>c:\users\dixit\appdata\local\programs\python\python38\lib\site-packages\keras\engine\training_utils.py in (.0)
  97         data = data.values if data.<strong>class</strong>.<strong>name</strong> == 'DataFrame' else data
  98         data = [data]
  ---&gt; 99     data = [standardize_single_array(x) for x in data]
  100
  101     if len(data) != len(names):</p>
  <p>c:\users\dixit\appdata\local\programs\python\python38\lib\site-packages\keras\engine\training_utils.py in standardize_single_array(x)
  32                 'Got tensor with shape: %s' % str(shape))
  33         return x
  ---&gt; 34     elif x.ndim == 1:
  35         x = np.expand_dims(x, 1)
  36     return x</p>
  <p>AttributeError: 'PrefetchDataset' object has no attribute 'ndim'</p>