def test_check_dimensions_invalid_text(self): with self.assertRaisesRegex( ValueError, 'The text input should be a 1D numpy array. ' r'Shape of the supplied image: \(2, 2\)'): utils._check_dimensions(image=np.ones((2, 2)).astype(np.float), saliency_map=np.ones(10).astype(np.float), model_type='text_cnn')
def test_check_dimensions_invalid_saliency_map(self): with self.assertRaisesRegex( ValueError, 'Saliency map should have 2 dimensions. ' r'Shape of the supplied Saliency map: \(2, 2, 3\)'): utils._check_dimensions(image=np.ones((2, 2, 2)).astype(np.float), saliency_map=np.ones( (2, 2, 3)).astype(np.float), model_type='cnn')