Exemplo n.º 1
0
        public SmartReply(string modelPath)
        {
            var options = new Interpreter.Options()
            {
                threads = 2
            };

            interpreter = new Interpreter(FileUtil.LoadFile(modelPath), options);
            interpreter.LogIOInfo();
        }
        public TextClassification(string modelPath, string vocabularyText)
        {
            vocabulary = BuildVocabulary(vocabularyText);

            // NO GPU
            var options = new Interpreter.Options()
            {
                threads = 2
            };

            interpreter = new Interpreter(FileUtil.LoadFile(modelPath), options);

            var inputInfo  = interpreter.GetInputTensorInfo(0);
            var outputInfo = interpreter.GetOutputTensorInfo(0);

            inputs  = new float[inputInfo.shape[1]];
            outputs = new float[outputInfo.shape[1]];
            interpreter.ResizeInputTensor(0, inputInfo.shape);
            interpreter.AllocateTensors();
        }