Beispiel #1
0
    def test_model_construct(self):
        # Default Model Construct

        cnn_model = CharacterLevelCnnModel(label_mapping=self.label_mapping)
        cnn_model._construct_model()
        # Test Details
        cnn_model.details()

        expected_layers = [
            "input_1",
            "lambda",
            "embedding",
            "conv1d",
            "dropout",
            "batch_normalization",
            "conv1d_1",
            "dropout_1",
            "batch_normalization_1",
            "conv1d_2",
            "dropout_2",
            "batch_normalization_2",
            "conv1d_3",
            "dropout_3",
            "batch_normalization_3",
            "dense",
            "dropout_4",
            "dense_1",
            "dropout_5",
            "dense_2",
            "tf_op_layer_ArgMax",
            "thresh_arg_max_layer",
        ]
        model_layers = [layer.name for layer in cnn_model._model.layers]
        self.assertEqual(len(expected_layers), len(model_layers))
        self.assertEqual(17, cnn_model.num_labels)
Beispiel #2
0
    def test_model_construct(self):
        # Default Model Construct

        cnn_model = CharacterLevelCnnModel(label_mapping=self.label_mapping)
        cnn_model._construct_model()
        # Test Details
        cnn_model.details()

        expected_layers = [
            'input_1', 'lambda', 'embedding', 'conv1d', 'dropout',
            'batch_normalization', 'conv1d_1', 'dropout_1',
            'batch_normalization_1', 'conv1d_2', 'dropout_2',
            'batch_normalization_2', 'conv1d_3', 'dropout_3',
            'batch_normalization_3', 'dense', 'dropout_4', 'dense_1',
            'dropout_5', 'dense_2', 'tf_op_layer_ArgMax',
            'thresh_arg_max_layer'
        ]
        model_layers = [layer.name for layer in cnn_model._model.layers]
        self.assertEqual(len(expected_layers), len(model_layers))
        self.assertEqual(17, cnn_model.num_labels)