def test_image_input_unsupported_type(): x = 'unknown' input_node = node.ImageInput() with pytest.raises(TypeError) as info: input_node.fit(x) x = input_node.transform(x) assert 'Expect the data to ImageInput to be numpy' in str(info.value)
def test_image_input_with_illegal_dim(): x = common.generate_data(shape=(32, )) input_node = node.ImageInput() with pytest.raises(ValueError) as info: input_node.fit(x) x = input_node.transform(x) assert 'Expect the data to ImageInput to have 3' in str(info.value)
def test_image_input_numerical(): x = np.array([[['unknown']]]) input_node = node.ImageInput() with pytest.raises(TypeError) as info: input_node.fit(x) x = input_node.transform(x) assert 'Expect the data to ImageInput to be numerical' in str(info.value)
def test_image_input_with_three_dim(): x = common.generate_data(shape=(32, 32)) input_node = node.ImageInput() x = input_node.transform(x) assert isinstance(x, tf.data.Dataset) for a in x: assert a.shape == (32, 32, 1) break
def __init__(self, outputs, **kwargs): super().__init__(inputs=node.ImageInput(), outputs=outputs, **kwargs)
def test_image_input(): x = common.generate_data() input_node = node.ImageInput() input_node.fit(x) assert isinstance(input_node.transform(x), tf.data.Dataset)