def test_xception_get_config_has_all_attributes(): block = blocks.XceptionBlock() config = block.get_config() assert utils.get_func_args( blocks.XceptionBlock.__init__).issubset(config.keys())
def test_xception_build_return_tensor(): block = blocks.XceptionBlock() outputs = block.build(kerastuner.HyperParameters(), tf.keras.Input(shape=(32, 32, 3), dtype=tf.float32)) assert len(nest.flatten(outputs)) == 1 assert isinstance(nest.flatten(outputs)[0], tf.Tensor)
def test_xception_pretrained_error_with_two_channels(): block = blocks.XceptionBlock(pretrained=True) with pytest.raises(ValueError) as info: block.build(kerastuner.HyperParameters(), tf.keras.Input(shape=(224, 224, 2), dtype=tf.float32)) assert 'When pretrained is set to True' in str(info.value)
def test_xception_pretrained_with_one_channel_input(): block = blocks.XceptionBlock(pretrained=True) outputs = block.build( keras_tuner.HyperParameters(), tf.keras.Input(shape=(224, 224, 1), dtype=tf.float32), ) assert len(nest.flatten(outputs)) == 1
def test_xception_pretrained_build_return_tensor(): block = blocks.XceptionBlock(pretrained=True) outputs = block.build( keras_tuner.HyperParameters(), tf.keras.Input(shape=(32, 32, 3), dtype=tf.float32), ) assert len(nest.flatten(outputs)) == 1
def test_xception_deserialize_to_xception(): serialized_block = blocks.serialize(blocks.XceptionBlock()) block = blocks.deserialize(serialized_block) assert isinstance(block, blocks.XceptionBlock)