Skip to content

Commit 092a4b8

Browse files
Conchylicultorcopybara-github
authored andcommitted
Automated documentation update
PiperOrigin-RevId: 258775252
1 parent 51a66d4 commit 092a4b8

File tree

6 files changed

+1222
-1848
lines changed

6 files changed

+1222
-1848
lines changed

docs/api_docs/python/tfds/core/BeamBasedBuilder.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,46 @@ Constructs a `tf.data.Dataset`.
9595

9696
Callers must pass arguments as keyword arguments.
9797

98+
The output types vary depending on the parameters. Examples:
99+
100+
```python
101+
builder = tfds.builder('imdb_reviews')
102+
builder.download_and_prepare()
103+
104+
# Default parameters: Returns the dict of tf.data.Dataset
105+
ds_all_dict = builder.as_dataset()
106+
assert isinstance(ds_all_dict, dict)
107+
print(ds_all_dict.keys()) # ==> ['test', 'train', 'unsupervised']
108+
109+
assert isinstance(ds_all_dict['test'], tf.data.Dataset)
110+
# Each dataset (test, train, unsup.) consists of dictionaries
111+
# {'label': <tf.Tensor: .. dtype=int64, numpy=1>,
112+
# 'text': <tf.Tensor: .. dtype=string, numpy=b"I've watched the movie ..">}
113+
# {'label': <tf.Tensor: .. dtype=int64, numpy=1>,
114+
# 'text': <tf.Tensor: .. dtype=string, numpy=b'If you love Japanese ..'>}
115+
116+
# With as_supervised: tf.data.Dataset only contains (feature, label) tuples
117+
ds_all_supervised = builder.as_dataset(as_supervised=True)
118+
assert isinstance(ds_all_supervised, dict)
119+
print(ds_all_supervised.keys()) # ==> ['test', 'train', 'unsupervised']
120+
121+
assert isinstance(ds_all_supervised['test'], tf.data.Dataset)
122+
# Each dataset (test, train, unsup.) consists of tuples (text, label)
123+
# (<tf.Tensor: ... dtype=string, numpy=b"I've watched the movie ..">,
124+
# <tf.Tensor: ... dtype=int64, numpy=1>)
125+
# (<tf.Tensor: ... dtype=string, numpy=b"If you love Japanese ..">,
126+
# <tf.Tensor: ... dtype=int64, numpy=1>)
127+
128+
# Same as above plus requesting a particular split
129+
ds_test_supervised = builder.as_dataset(as_supervised=True, split='test')
130+
assert isinstance(ds_test_supervised, tf.data.Dataset)
131+
# The dataset consists of tuples (text, label)
132+
# (<tf.Tensor: ... dtype=string, numpy=b"I've watched the movie ..">,
133+
# <tf.Tensor: ... dtype=int64, numpy=1>)
134+
# (<tf.Tensor: ... dtype=string, numpy=b"If you love Japanese ..">,
135+
# <tf.Tensor: ... dtype=int64, numpy=1>)
136+
```
137+
98138
#### Args:
99139

100140
* <b>`split`</b>:

docs/api_docs/python/tfds/core/DatasetBuilder.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,46 @@ Constructs a `tf.data.Dataset`.
126126

127127
Callers must pass arguments as keyword arguments.
128128

129+
The output types vary depending on the parameters. Examples:
130+
131+
```python
132+
builder = tfds.builder('imdb_reviews')
133+
builder.download_and_prepare()
134+
135+
# Default parameters: Returns the dict of tf.data.Dataset
136+
ds_all_dict = builder.as_dataset()
137+
assert isinstance(ds_all_dict, dict)
138+
print(ds_all_dict.keys()) # ==> ['test', 'train', 'unsupervised']
139+
140+
assert isinstance(ds_all_dict['test'], tf.data.Dataset)
141+
# Each dataset (test, train, unsup.) consists of dictionaries
142+
# {'label': <tf.Tensor: .. dtype=int64, numpy=1>,
143+
# 'text': <tf.Tensor: .. dtype=string, numpy=b"I've watched the movie ..">}
144+
# {'label': <tf.Tensor: .. dtype=int64, numpy=1>,
145+
# 'text': <tf.Tensor: .. dtype=string, numpy=b'If you love Japanese ..'>}
146+
147+
# With as_supervised: tf.data.Dataset only contains (feature, label) tuples
148+
ds_all_supervised = builder.as_dataset(as_supervised=True)
149+
assert isinstance(ds_all_supervised, dict)
150+
print(ds_all_supervised.keys()) # ==> ['test', 'train', 'unsupervised']
151+
152+
assert isinstance(ds_all_supervised['test'], tf.data.Dataset)
153+
# Each dataset (test, train, unsup.) consists of tuples (text, label)
154+
# (<tf.Tensor: ... dtype=string, numpy=b"I've watched the movie ..">,
155+
# <tf.Tensor: ... dtype=int64, numpy=1>)
156+
# (<tf.Tensor: ... dtype=string, numpy=b"If you love Japanese ..">,
157+
# <tf.Tensor: ... dtype=int64, numpy=1>)
158+
159+
# Same as above plus requesting a particular split
160+
ds_test_supervised = builder.as_dataset(as_supervised=True, split='test')
161+
assert isinstance(ds_test_supervised, tf.data.Dataset)
162+
# The dataset consists of tuples (text, label)
163+
# (<tf.Tensor: ... dtype=string, numpy=b"I've watched the movie ..">,
164+
# <tf.Tensor: ... dtype=int64, numpy=1>)
165+
# (<tf.Tensor: ... dtype=string, numpy=b"If you love Japanese ..">,
166+
# <tf.Tensor: ... dtype=int64, numpy=1>)
167+
```
168+
129169
#### Args:
130170

131171
* <b>`split`</b>:

docs/api_docs/python/tfds/core/GeneratorBasedBuilder.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,46 @@ Constructs a `tf.data.Dataset`.
104104

105105
Callers must pass arguments as keyword arguments.
106106

107+
The output types vary depending on the parameters. Examples:
108+
109+
```python
110+
builder = tfds.builder('imdb_reviews')
111+
builder.download_and_prepare()
112+
113+
# Default parameters: Returns the dict of tf.data.Dataset
114+
ds_all_dict = builder.as_dataset()
115+
assert isinstance(ds_all_dict, dict)
116+
print(ds_all_dict.keys()) # ==> ['test', 'train', 'unsupervised']
117+
118+
assert isinstance(ds_all_dict['test'], tf.data.Dataset)
119+
# Each dataset (test, train, unsup.) consists of dictionaries
120+
# {'label': <tf.Tensor: .. dtype=int64, numpy=1>,
121+
# 'text': <tf.Tensor: .. dtype=string, numpy=b"I've watched the movie ..">}
122+
# {'label': <tf.Tensor: .. dtype=int64, numpy=1>,
123+
# 'text': <tf.Tensor: .. dtype=string, numpy=b'If you love Japanese ..'>}
124+
125+
# With as_supervised: tf.data.Dataset only contains (feature, label) tuples
126+
ds_all_supervised = builder.as_dataset(as_supervised=True)
127+
assert isinstance(ds_all_supervised, dict)
128+
print(ds_all_supervised.keys()) # ==> ['test', 'train', 'unsupervised']
129+
130+
assert isinstance(ds_all_supervised['test'], tf.data.Dataset)
131+
# Each dataset (test, train, unsup.) consists of tuples (text, label)
132+
# (<tf.Tensor: ... dtype=string, numpy=b"I've watched the movie ..">,
133+
# <tf.Tensor: ... dtype=int64, numpy=1>)
134+
# (<tf.Tensor: ... dtype=string, numpy=b"If you love Japanese ..">,
135+
# <tf.Tensor: ... dtype=int64, numpy=1>)
136+
137+
# Same as above plus requesting a particular split
138+
ds_test_supervised = builder.as_dataset(as_supervised=True, split='test')
139+
assert isinstance(ds_test_supervised, tf.data.Dataset)
140+
# The dataset consists of tuples (text, label)
141+
# (<tf.Tensor: ... dtype=string, numpy=b"I've watched the movie ..">,
142+
# <tf.Tensor: ... dtype=int64, numpy=1>)
143+
# (<tf.Tensor: ... dtype=string, numpy=b"If you love Japanese ..">,
144+
# <tf.Tensor: ... dtype=int64, numpy=1>)
145+
```
146+
107147
#### Args:
108148

109149
* <b>`split`</b>:

docs/api_docs/python/tfds/testing/DummyDatasetSharedGenerator.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,46 @@ Constructs a `tf.data.Dataset`.
9797

9898
Callers must pass arguments as keyword arguments.
9999

100+
The output types vary depending on the parameters. Examples:
101+
102+
```python
103+
builder = tfds.builder('imdb_reviews')
104+
builder.download_and_prepare()
105+
106+
# Default parameters: Returns the dict of tf.data.Dataset
107+
ds_all_dict = builder.as_dataset()
108+
assert isinstance(ds_all_dict, dict)
109+
print(ds_all_dict.keys()) # ==> ['test', 'train', 'unsupervised']
110+
111+
assert isinstance(ds_all_dict['test'], tf.data.Dataset)
112+
# Each dataset (test, train, unsup.) consists of dictionaries
113+
# {'label': <tf.Tensor: .. dtype=int64, numpy=1>,
114+
# 'text': <tf.Tensor: .. dtype=string, numpy=b"I've watched the movie ..">}
115+
# {'label': <tf.Tensor: .. dtype=int64, numpy=1>,
116+
# 'text': <tf.Tensor: .. dtype=string, numpy=b'If you love Japanese ..'>}
117+
118+
# With as_supervised: tf.data.Dataset only contains (feature, label) tuples
119+
ds_all_supervised = builder.as_dataset(as_supervised=True)
120+
assert isinstance(ds_all_supervised, dict)
121+
print(ds_all_supervised.keys()) # ==> ['test', 'train', 'unsupervised']
122+
123+
assert isinstance(ds_all_supervised['test'], tf.data.Dataset)
124+
# Each dataset (test, train, unsup.) consists of tuples (text, label)
125+
# (<tf.Tensor: ... dtype=string, numpy=b"I've watched the movie ..">,
126+
# <tf.Tensor: ... dtype=int64, numpy=1>)
127+
# (<tf.Tensor: ... dtype=string, numpy=b"If you love Japanese ..">,
128+
# <tf.Tensor: ... dtype=int64, numpy=1>)
129+
130+
# Same as above plus requesting a particular split
131+
ds_test_supervised = builder.as_dataset(as_supervised=True, split='test')
132+
assert isinstance(ds_test_supervised, tf.data.Dataset)
133+
# The dataset consists of tuples (text, label)
134+
# (<tf.Tensor: ... dtype=string, numpy=b"I've watched the movie ..">,
135+
# <tf.Tensor: ... dtype=int64, numpy=1>)
136+
# (<tf.Tensor: ... dtype=string, numpy=b"If you love Japanese ..">,
137+
# <tf.Tensor: ... dtype=int64, numpy=1>)
138+
```
139+
100140
#### Args:
101141

102142
* <b>`split`</b>:

docs/api_docs/python/tfds/testing/DummyMnist.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,46 @@ Constructs a `tf.data.Dataset`.
9797

9898
Callers must pass arguments as keyword arguments.
9999

100+
The output types vary depending on the parameters. Examples:
101+
102+
```python
103+
builder = tfds.builder('imdb_reviews')
104+
builder.download_and_prepare()
105+
106+
# Default parameters: Returns the dict of tf.data.Dataset
107+
ds_all_dict = builder.as_dataset()
108+
assert isinstance(ds_all_dict, dict)
109+
print(ds_all_dict.keys()) # ==> ['test', 'train', 'unsupervised']
110+
111+
assert isinstance(ds_all_dict['test'], tf.data.Dataset)
112+
# Each dataset (test, train, unsup.) consists of dictionaries
113+
# {'label': <tf.Tensor: .. dtype=int64, numpy=1>,
114+
# 'text': <tf.Tensor: .. dtype=string, numpy=b"I've watched the movie ..">}
115+
# {'label': <tf.Tensor: .. dtype=int64, numpy=1>,
116+
# 'text': <tf.Tensor: .. dtype=string, numpy=b'If you love Japanese ..'>}
117+
118+
# With as_supervised: tf.data.Dataset only contains (feature, label) tuples
119+
ds_all_supervised = builder.as_dataset(as_supervised=True)
120+
assert isinstance(ds_all_supervised, dict)
121+
print(ds_all_supervised.keys()) # ==> ['test', 'train', 'unsupervised']
122+
123+
assert isinstance(ds_all_supervised['test'], tf.data.Dataset)
124+
# Each dataset (test, train, unsup.) consists of tuples (text, label)
125+
# (<tf.Tensor: ... dtype=string, numpy=b"I've watched the movie ..">,
126+
# <tf.Tensor: ... dtype=int64, numpy=1>)
127+
# (<tf.Tensor: ... dtype=string, numpy=b"If you love Japanese ..">,
128+
# <tf.Tensor: ... dtype=int64, numpy=1>)
129+
130+
# Same as above plus requesting a particular split
131+
ds_test_supervised = builder.as_dataset(as_supervised=True, split='test')
132+
assert isinstance(ds_test_supervised, tf.data.Dataset)
133+
# The dataset consists of tuples (text, label)
134+
# (<tf.Tensor: ... dtype=string, numpy=b"I've watched the movie ..">,
135+
# <tf.Tensor: ... dtype=int64, numpy=1>)
136+
# (<tf.Tensor: ... dtype=string, numpy=b"If you love Japanese ..">,
137+
# <tf.Tensor: ... dtype=int64, numpy=1>)
138+
```
139+
100140
#### Args:
101141

102142
* <b>`split`</b>:

0 commit comments

Comments
 (0)