Skip to content

Commit

Permalink
Allow empty validation set in fit.
Browse files Browse the repository at this point in the history
  • Loading branch information
ohinds committed Aug 31, 2023
1 parent 4106a2d commit 5c1738b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 4 additions & 2 deletions nobrainer/processing/segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,10 @@ def _compile():
dataset_train.dataset,
epochs=epochs,
steps_per_epoch=dataset_train.get_steps_per_epoch(),
validation_data=dataset_validate.dataset,
validation_steps=dataset_validate.get_steps_per_epoch(),
validation_data=dataset_validate.dataset if dataset_validate
else None,
validation_steps=dataset_validate.get_steps_per_epoch()
if dataset_validate else None,
callbacks=callbacks,
)

Expand Down
6 changes: 2 additions & 4 deletions nobrainer/tests/checkpoint_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from numpy.testing import assert_allclose
import tensorflow as tf

from nobrainer.dataset import Dataset
from nobrainer.models import meshnet
from nobrainer.processing.segmentation import Segmentation

Expand All @@ -15,10 +16,7 @@ def _get_toy_dataset():
train = tf.data.Dataset.from_tensors(
(np.random.rand(*data_shape), np.random.randint(0, 1, data_shape))
)
train.scalar_labels = False
train.n_volumes = data_shape[0]
train.volume_shape = data_shape[1:4]
return train
return Dataset(train, data_shape[0], data_shape[1:4], 1)


def _assert_model_weights_allclose(model1, model2):
Expand Down

0 comments on commit 5c1738b

Please sign in to comment.