Skip to content

Commit

Permalink
Move toco
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnycase committed Dec 29, 2018
1 parent 5d23dee commit fc3bd1a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/NnCase.Cli/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,13 @@ private static async Task ConvertToTFLite(Graph graph, string tflitePath)
var tmpPb = Path.GetTempFileName();
using (var f = File.Open(tmpPb, FileMode.Create, FileAccess.Write))
await ctx.SaveAsync(f);
using (var toco = Process.Start(Path.Combine(Path.GetDirectoryName(typeof(Program).Assembly.Location), "toco"), $" --input_file={tmpPb} --input_format=TENSORFLOW_GRAPHDEF --output_file={tflitePath} --output_format=TFLITE --input_shape=1,{dim[2]},{dim[3]},{dim[1]} --input_array={input} --output_array={output} --inference_type=FLOAT"))

var binPath = Path.Combine(Path.GetDirectoryName(typeof(Program).Assembly.Location), "bin");
var args = $" --input_file={tmpPb} --input_format=TENSORFLOW_GRAPHDEF --output_file={tflitePath} --output_format=TFLITE --input_shape=1,{dim[2]},{dim[3]},{dim[1]} --input_array={input} --output_array={output} --inference_type=FLOAT";
using (var toco = Process.Start(new ProcessStartInfo(Path.Combine(binPath, "toco"), args)
{
WorkingDirectory = binPath
}))
{
toco.WaitForExit();
if (toco.ExitCode != 0)
Expand Down

0 comments on commit fc3bd1a

Please sign in to comment.