AttributeError: 'Tensor' object has no attribute 'batch'

When I run the following code :

def windowed_dataset(series, window_size, batch_size, shuffle_buffer):
dataset =
datset = dataset.window(window_size+1, shift=1, drop_remainder=True)
dataset = dataset.flat_map(lambda window: window.batch(window_size+1))
dataset = window: (window[:-1], window[-1]))
dataset = dataset.shuffle(shuffle_buffer)
dataset = dataset.batch(batch_size).prefetch(1)

return dataset

I get the following error :

Please fix the typo datset.
Don’t forget to remove your code from the post.

There is no edit option ?

Every jupyter cell has an option to edit the content. Please use desktop if mobile view is confusing.