Esempio n. 1
0
        private void TestModelSerialization()
        {
            string modelPath       = Path.Combine(Directory.GetCurrentDirectory(), "squeezenet.onnx");
            string modelOutputPath = Path.Combine(Directory.GetCurrentDirectory(), "optimized-squeezenet.onnx");
            // Set the optimized model file path to assert that no exception are thrown.
            SessionOptions options = new SessionOptions();

            options.SetOptimizedModelFilePath(modelOutputPath);
            options.SetSessionGraphOptimizationLevel(1);
            var session = new InferenceSession(modelPath, options);

            Assert.NotNull(session);
            Assert.True(File.Exists(modelOutputPath));
        }