package org.algorithm.test;

import org.algorithm.core.cnn.model.RelationExtractionSubModel;
import org.tensorflow.Tensor;

import java.util.HashMap;
import java.util.Map;

/**测试子模型加载
 * @Author: bijl
 * @Date: 2019/6/12 16:57
 * @Decription:
 */
public class ReSubModelTest {

    public static void main(String[] args) {
//        RelationExtractionSubModel subModel = new RelationExtractionSubModel("cnn_1d_low");
//        RelationExtractionSubModel subModel = new RelationExtractionSubModel("cnn_1d_lstm_low");
        Map<String, Tensor<Float>> lstm_low_api_map = new HashMap<>();
        lstm_low_api_map.put("input_keep_prob",Tensor.create(1.0f, Float.class));
        lstm_low_api_map.put("output_keep_prob",Tensor.create(1.0f, Float.class));
        lstm_low_api_map.put("state_keep_prob",Tensor.create(1.0f, Float.class));
        RelationExtractionSubModel subModel = new RelationExtractionSubModel("lstm_low_api", lstm_low_api_map);


        int[][] inputValues = new int[3][512];
        for (int i=0; i< inputValues.length; i++)
            for (int j=0; j<inputValues[0].length; j++)
                inputValues[i][j] = 0;
        float[][] result = subModel.sigmoid(inputValues, 1);
        System.out.println(result[0][0]);
        System.out.println(result.length);
        System.out.println(result[0].length);
    }
}
