@@ -0,0 +1,2248 @@
+#%0A# Copyright 2018 Analytics Zoo Authors.%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A#     http://www.apache.org/licenses/LICENSE-2.0%0A#%0A# Unless required by applicable law or agreed to in writing, software%0A# distributed under the License is distributed on an %22AS IS%22 BASIS,%0A# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A# See the License for the specific language governing permissions and%0A# limitations under the License.%0A#%0A%0Aimport pytest%0A%0Aimport numpy as np%0Afrom test.zoo.pipeline.utils.test_utils import ZooTestCase%0Afrom zoo.tfpark.text import *%0A%0A%0Aclass TestTextModels(ZooTestCase):%0A%0A    def test_intent_entity(self):%0A        model = IntentEntity(num_intents=8, num_entities=5, word_length=10,%0A                             word_vocab_size=200, char_vocab_size=50)%0A        input_data = %5Bnp.random.randint(200, size=(8, 30)), np.random.randint(50, size=(8, 30, 10))%5D%0A        output = model.predict(input_data, distributed=True)%0A        assert isinstance(output, list) and len(output) == 2%0A        assert output%5B0%5D.shape == (8, 8)%0A        assert output%5B1%5D.shape == (8, 30, 5)%0A        self.assert_tfpark_model_save_load(model, input_data)%0A%0A    def test_ner_crf_reg_mode(self):%0A        model = NER(num_entities=10, word_length=5, word_vocab_size=20, char_vocab_size=10)%0A        input_data = %5Bnp.random.randint(20, size=(15, 12)), np.random.randint(10, size=(15, 12, 5))%5D%0A        output = model.predict(input_data, distributed=True)%0A        assert output.shape == (15, 12, 10)%0A        self.assert_tfpark_model_save_load(model, input_data)%0A%0A    def test_ner_crf_pad_mode(self):%0A        model = NER(num_entities=15, word_length=8, word_vocab_size=20,%0A                    char_vocab_size=10, crf_mode=%22pad%22)%0A        input_data = %5Bnp.random.randint(20, size=(4, 12)), np.random.randint(10, size=(4, 12, 8)),%0A                      np.random.randint(12, size=(15, 1))%5D%0A        output = model.predict(input_data, distributed=True)%0A        assert output.shape == (4, 12, 15)%0A        self.assert_tfpark_model_save_load(model, input_data)%0A%0A%0Aif __name__ == %22__main__%22:%0A    pytest.main(%5B__file__%5D)%0A

Add IntentEntity model in tfpark (#1188)