ageron / ageron/handson-ml2

[Chap 16] TypeError: '_NestedVariant' object is not subscriptable

Open
#271 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
30k
Forks
13.1k
PR merge metrics
No merged PRs in 30d

Description

In chapter 16 notebook running this cell:

```
batch_size = 32
dataset = dataset.shuffle(10000).batch(batch_size)
dataset = dataset.map(lambda windows: (windows[:, :-1], windows[:, 1:]))
```

produces this error in Colab:

```
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
in ()
6 batch_size = 32
7 dataset = dataset.shuffle(10000).batch(batch_size)
----> 8 dataset = dataset.map(lambda windows: (windows[:, :-1], windows[:, 1:]))

10 frames
/usr/local/lib/python3.6/dist-packages/tensorflow/python/autograph/impl/api.py in wrapper(*args, **kwargs)
256 except Exception as e: # pylint:disable=broad-except
257 if hasattr(e, 'ag_error_metadata'):
--> 258 raise e.ag_error_metadata.to_exception(e)
259 else:
260 raise

TypeError: in user code:

:8 None *
dataset = dataset.map(lambda windows: (windows[:, :-1], windows[:, 1:]))

TypeError: '_NestedVariant' object is not subscriptable
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.