From 7f7e23e39954fe503f8eead5a5e17cb28589968e Mon Sep 17 00:00:00 2001 From: Ethan Harris Date: Fri, 24 May 2019 08:15:10 +0100 Subject: [PATCH] Fix build errors --- tests/callbacks/test_tensor_board.py | 20 ++++++++++---------- tests/variational/test_datasets.py | 2 +- tests/variational/test_visualisation.py | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/callbacks/test_tensor_board.py b/tests/callbacks/test_tensor_board.py index 1e3c1e3d..e3602bf6 100644 --- a/tests/callbacks/test_tensor_board.py +++ b/tests/callbacks/test_tensor_board.py @@ -313,7 +313,7 @@ def test_writer_closed_on_end_visdom_visdom(self, mock_visdom, mock_writer, _): self.assertEqual(mock_writer.return_value.close.call_count, 1) @patch('torchbearer.callbacks.tensor_board.os.makedirs') - @patch('torchbearer.callbacks.tensor_board.utils.make_grid') + @patch('torchvision.utils.make_grid') @patch('tensorboardX.SummaryWriter') def test_simple_case(self, mock_board, mock_grid, _): mock_board.return_value = Mock() @@ -336,7 +336,7 @@ def test_simple_case(self, mock_board, mock_grid, _): self.assertTrue(mock_grid.call_args[0][0].size() == state['x'].size()) tboard.on_end({}) - @patch('torchbearer.callbacks.tensor_board.utils.make_grid') + @patch('torchvision.utils.make_grid') @patch('torchbearer.callbacks.tensor_board.os.makedirs') @patch('tensorboardX.torchvis.VisdomWriter') @patch('visdom.Visdom') @@ -362,7 +362,7 @@ def test_simple_case_visdom(self, mock_visdom, mock_writer, _, mock_grid): tboard.on_end({}) @patch('torchbearer.callbacks.tensor_board.os.makedirs') - @patch('torchbearer.callbacks.tensor_board.utils.make_grid') + @patch('torchvision.utils.make_grid') @patch('tensorboardX.SummaryWriter') def test_multi_batch(self, mock_board, mock_grid, _): mock_board.return_value = Mock() @@ -386,7 +386,7 @@ def test_multi_batch(self, mock_board, mock_grid, _): self.assertTrue(mock_grid.call_args[0][0].size() == torch.ones(36, 3, 10, 10).size()) tboard.on_end({}) - @patch('torchbearer.callbacks.tensor_board.utils.make_grid') + @patch('torchvision.utils.make_grid') @patch('torchbearer.callbacks.tensor_board.os.makedirs') @patch('tensorboardX.torchvis.VisdomWriter') @patch('visdom.Visdom') @@ -413,7 +413,7 @@ def test_multi_batch_visdom(self, mock_visdom, mock_writer, _, mock_grid): tboard.on_end({}) @patch('torchbearer.callbacks.tensor_board.os.makedirs') - @patch('torchbearer.callbacks.tensor_board.utils.make_grid') + @patch('torchvision.utils.make_grid') @patch('tensorboardX.SummaryWriter') def test_multi_epoch(self, mock_board, mock_grid, _): mock_board.return_value = Mock() @@ -438,7 +438,7 @@ def test_multi_epoch(self, mock_board, mock_grid, _): self.assertTrue(mock_grid.call_args[0][0].size() == torch.ones(36, 3, 10, 10).size()) tboard.on_end({}) - @patch('torchbearer.callbacks.tensor_board.utils.make_grid') + @patch('torchvision.utils.make_grid') @patch('torchbearer.callbacks.tensor_board.os.makedirs') @patch('tensorboardX.torchvis.VisdomWriter') @patch('visdom.Visdom') @@ -466,7 +466,7 @@ def test_multi_epoch_visdom(self, mock_visdom, mock_writer, _, mock_grid): tboard.on_end({}) @patch('torchbearer.callbacks.tensor_board.os.makedirs') - @patch('torchbearer.callbacks.tensor_board.utils.make_grid') + @patch('torchvision.utils.make_grid') @patch('tensorboardX.SummaryWriter') def test_single_channel(self, mock_board, mock_grid, _): mock_board.return_value = Mock() @@ -489,7 +489,7 @@ def test_single_channel(self, mock_board, mock_grid, _): self.assertTrue(mock_grid.call_args[0][0].size() == torch.ones(18, 1, 10, 10).size()) tboard.on_end({}) - @patch('torchbearer.callbacks.tensor_board.utils.make_grid') + @patch('torchvision.utils.make_grid') @patch('torchbearer.callbacks.tensor_board.os.makedirs') @patch('tensorboardX.torchvis.VisdomWriter') @patch('visdom.Visdom') @@ -515,7 +515,7 @@ def test_single_channel_visdom(self, mock_visdom, mock_writer, _, mock_grid): tboard.on_end({}) @patch('torchbearer.callbacks.tensor_board.os.makedirs') - @patch('torchbearer.callbacks.tensor_board.utils.make_grid') + @patch('torchvision.utils.make_grid') @patch('tensorboardX.SummaryWriter') def test_odd_batches(self, mock_board, mock_grid, _): mock_board.return_value = Mock() @@ -540,7 +540,7 @@ def test_odd_batches(self, mock_board, mock_grid, _): self.assertTrue(mock_grid.call_args[0][0].size() == torch.ones(40, 3, 10, 10).size()) tboard.on_end({}) - @patch('torchbearer.callbacks.tensor_board.utils.make_grid') + @patch('torchvision.utils.make_grid') @patch('torchbearer.callbacks.tensor_board.os.makedirs') @patch('tensorboardX.torchvis.VisdomWriter') @patch('visdom.Visdom') diff --git a/tests/variational/test_datasets.py b/tests/variational/test_datasets.py index 2eec4da8..8b972c08 100644 --- a/tests/variational/test_datasets.py +++ b/tests/variational/test_datasets.py @@ -156,7 +156,7 @@ def test_celeba_hq_use_numpy_loader(self, mock_gi, mock_len, mock_loader): @patch.object(ds.SimpleImageFolder, '__len__') @patch.object(ds.SimpleImageFolder, '__getitem__') - @patch('torchbearer.variational.datasets.default_loader') + @patch('torchvision.datasets.folder.default_loader') def test_celeba_hq_use_default_loader(self, mock_loader, mock_gi, mock_len, ): import torchvision mock_len.return_value = 10 diff --git a/tests/variational/test_visualisation.py b/tests/variational/test_visualisation.py index 2e52497d..4d8d006f 100644 --- a/tests/variational/test_visualisation.py +++ b/tests/variational/test_visualisation.py @@ -100,7 +100,7 @@ def test_data_key_str(self): self.assertTrue(lw.data == state['test_key']) - @patch('torchbearer.variational.visualisation.save_image') + @patch('torchvision.utils.save_image') def test_save_walk(self, mock_save_img): state = {tb.MODEL: Mock(), tb.X: Mock(), tb.DEVICE: 'cpu'}