def test_fail_on_mismatching_dimensionality(self): try: from lasagne.layers.dnn import SpatialPyramidPoolingDNNLayer except ImportError: pytest.skip("cuDNN not available") with pytest.raises(ValueError) as exc: SpatialPyramidPoolingDNNLayer((10, 20, 30)) assert "Expected 4 input dimensions" in exc.value.args[0] with pytest.raises(ValueError) as exc: SpatialPyramidPoolingDNNLayer((10, 20, 30, 40, 50)) assert "Expected 4 input dimensions" in exc.value.args[0]
def layer(self, input_layer, pool_dims): try: from lasagne.layers.dnn import SpatialPyramidPoolingDNNLayer except ImportError: pytest.skip("cuDNN not available") return SpatialPyramidPoolingDNNLayer(input_layer, pool_dims=pool_dims)