예제 #1
0
 public static TF_Graph Import(string filePath, TF_ImportGraphDefOptions options, out List <TF_Operation> ops, out TF_Status status) =>
 Import(File.ReadAllBytes(filePath), options, out ops, out status);
예제 #2
0
 public OpException(TF_Operation op, TF_Status status) :
     base(string.Format("An error occurred during operation {0}: {1}", c_api.TF_OperationName(op) ?? "(unknown op)",
                        tf_status.TF_Message(status) ?? "(unknown status)"))
 {
 }
예제 #3
0
        public static TF_Graph Import(byte[] buffer, TF_ImportGraphDefOptions options, out List <TF_Operation> ops, out TF_Status status)
        {
            var b     = new Buffer(buffer);
            var graph = c_api.TF_NewGraph();

            status = tf_status.TF_NewStatus();
            ops    = null;
            c_api.TF_GraphImportGraphDef(graph, b, options, status);
            if (graph != null)
            {
                ulong        pos = 0;
                TF_Operation op;
                ops = new List <TF_Operation>();
                while ((op = c_api.TF_GraphNextOperation(graph, ref pos)) != null)
                {
                    ops.Add(op);
                }
            }
            if (ops != null && ops.Count > 0)
            {
                var names = ops.Select(o => new { Name = c_api.TF_OperationName(o), Type = c_api.TF_OperationOpType(o) });
            }
            return(graph);
        }