Skip to content

Commit a54a9b7

Browse files
author
cmdupuis3
committed
minor updates
1 parent da42a9c commit a54a9b7

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

xbatcher/generators.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ class BatchGenerator:
9999
If ``True``, each batch will be loaded into memory before reshaping /
100100
processing, triggering any dask arrays to be computed.
101101
squeeze_batch_dim : bool, optional
102-
If ``False", each batch's dataset will have a "batch" dimension of size 1
103-
prepended to the array. This functionality is useful for interoperability
104-
with Keras / Tensorflow.
102+
If ``False" and all dims are input dims, each batch's dataset will have a
103+
"batch" dimension of size 1 prepended to the array. This functionality is
104+
useful for interoperability with Keras / Tensorflow.
105105
106106
Yields
107107
------

xbatcher/tests/test_generators.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,24 +169,23 @@ def test_batch_3d_2d_input_concat(sample_ds_3d, bsize):
169169
)
170170

171171

172-
@pytest.mark.parametrize('bsize', [5, 10])
172+
@pytest.mark.parametrize('bsize', [10, 20])
173173
def test_batch_1d_squeeze_batch_dim(sample_ds_1d, bsize):
174-
xbsize = 20
175174
bg = BatchGenerator(
176175
sample_ds_1d,
177-
input_dims={'x': xbsize},
176+
input_dims={'x': bsize},
178177
squeeze_batch_dim=False,
179178
)
180179
for ds_batch in bg:
181-
assert list(ds_batch['foo'].shape) == [1, xbsize]
180+
assert list(ds_batch['foo'].shape) == [1, bsize]
182181

183182
bg2 = BatchGenerator(
184183
sample_ds_1d,
185-
input_dims={'x': xbsize},
184+
input_dims={'x': bsize},
186185
squeeze_batch_dim=True,
187186
)
188187
for ds_batch in bg2:
189-
assert list(ds_batch['foo'].shape) == [xbsize]
188+
assert list(ds_batch['foo'].shape) == [bsize]
190189

191190

192191
@pytest.mark.parametrize('bsize', [5, 10])

0 commit comments

Comments
 (0)