title: I got this error when training gru model TypeError: unsupported operand type(s) for *: 'int' and 'NoneType'
body: <h2>code from Hands on Machine Learning with Scikit Learn Keras and TensorFlow 2nd Edition-2019</h2>
  
  <pre><code>import tensorflow as tf
  from tensorflow import keras
  
  from __future__ import print_function
  from keras.callbacks import LambdaCallback
  from keras.models import Sequential
  from keras.layers import Dense
  from keras.layers import LSTM
  from keras.optimizers import RMSprop
  from keras.utils.data_utils import get_file
  import numpy as np
  import random
  import sys
  import io
  import gzip
  import urllib
  
  shakespeare_url = "https://homl.info/shakespeare" # shortcut URL
  filepath = keras.utils.get_file("shakespeare.txt", shakespeare_url)
  with open(filepath) as f:
      shakespeare_text = f.read()
  
  tokenizer = keras.preprocessing.text.Tokenizer(char_level=True)
  tokenizer.fit_on_texts([shakespeare_text])
  
  max_id = len(tokenizer.word_index) # number of distinct characters
  dataset_size = tokenizer.document_count # total number of characters
  
  [encoded] = np.array(tokenizer.texts_to_sequences([shakespeare_text])) - 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 # target = input shifted 1 character ahead
  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>when execute history = model.fit(dataset, epochs=20) it give me 1/Unknown - 3s 3s/step
  and error TypeError: unsupported operand type(s) for *: 'int' and 'NoneType' </p>