forked from mmistakes/minimal-mistakes
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request mmistakes#93 from pesser/bbatches
Bbatches
- Loading branch information
Showing
2 changed files
with
29 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import pytest | ||
import numpy as np | ||
from edflow.iterators import batches | ||
|
||
|
||
def test_batch_to_canvas(): | ||
x = np.ones((9, 100, 100, 3)) | ||
canvas = batches.batch_to_canvas(x) | ||
assert canvas.shape == (300, 300, 3) | ||
|
||
canvas = batches.batch_to_canvas(x, cols=5) | ||
assert canvas.shape == (200, 500, 3) | ||
|
||
canvas = batches.batch_to_canvas(x, cols=1) | ||
assert canvas.shape == (900, 100, 3) | ||
|
||
canvas = batches.batch_to_canvas(x, cols=0) | ||
assert canvas.shape == (900, 100, 3) | ||
|
||
canvas = batches.batch_to_canvas(x, cols=None) | ||
assert canvas.shape == (300, 300, 3) |