public static TF_Output tf_output(IntPtr c_op, int index) { var ret = new TF_Output(); ret.oper = c_op; ret.index = index; return(ret); }
public TF_Output[] ReturnOutputs(IntPtr results) { IntPtr return_output_handle = IntPtr.Zero; int num_return_outputs = 0; c_api.TF_ImportGraphDefResultsReturnOutputs(results, ref num_return_outputs, ref return_output_handle); TF_Output[] return_outputs = new TF_Output[num_return_outputs]; for (int i = 0; i < num_return_outputs; i++) { var handle = return_output_handle + (Marshal.SizeOf <TF_Output>() * i); return_outputs[i] = Marshal.PtrToStructure <TF_Output>(handle); } return(return_outputs); }
public unsafe TF_Output[] ImportGraphDefWithReturnOutputs(Buffer graph_def, ImportGraphDefOptions opts, Status s) { var num_return_outputs = opts.NumReturnOutputs; var return_outputs = new TF_Output[num_return_outputs]; int size = Marshal.SizeOf <TF_Output>(); var return_output_handle = Marshal.AllocHGlobal(size * num_return_outputs); c_api.TF_GraphImportGraphDefWithReturnOutputs(_handle, graph_def, opts, return_output_handle, num_return_outputs, s); for (int i = 0; i < num_return_outputs; i++) { var handle = return_output_handle + i * size; return_outputs[i] = Marshal.PtrToStructure <TF_Output>(handle); } return(return_outputs); }
public static string[] TF_OperationOutputConsumers_wrapper(TF_Output oper_out) { int num_consumers = TF_OperationOutputNumConsumers(oper_out); int size = Marshal.SizeOf <TF_Input>(); var handle = Marshal.AllocHGlobal(size * num_consumers); int num = TF_OperationOutputConsumers(oper_out, handle, num_consumers); var consumers = new string[num_consumers]; for (int i = 0; i < num; i++) { TF_Input input = Marshal.PtrToStructure <TF_Input>(handle + i * size); consumers[i] = Marshal.PtrToStringAnsi(TF_OperationName(input.oper)); } return(consumers); }
public static string[] TF_OperationOutputConsumers_wrapper(TF_Output oper_out) { int num_consumers = TF_OperationOutputNumConsumers(oper_out); int size = Marshal.SizeOf <TF_Input>(); var handle = Marshal.AllocHGlobal(size * num_consumers); int num = TF_OperationOutputConsumers(oper_out, handle, num_consumers); var consumers = new string[num_consumers]; unsafe { var inputptr = (TF_Input *)handle; for (int i = 0; i < num; i++) { var oper = (inputptr + i)->oper; consumers[i] = Marshal.PtrToStringAnsi(TF_OperationName(oper)); } } return(consumers); }
public unsafe TF_Output[] ImportGraphDefWithReturnOutputs(Buffer graph_def, ImportGraphDefOptions opts, Status s) { as_default(); var num_return_outputs = opts.NumReturnOutputs; var return_outputs = new TF_Output[num_return_outputs]; int size = Marshal.SizeOf <TF_Output>(); var return_output_handle = Marshal.AllocHGlobal(size * num_return_outputs); c_api.TF_GraphImportGraphDefWithReturnOutputs(_handle, graph_def, opts, return_output_handle, num_return_outputs, s); var tf_output_ptr = (TF_Output *)return_output_handle; for (int i = 0; i < num_return_outputs; i++) { return_outputs[i] = *(tf_output_ptr + i); } Marshal.FreeHGlobal(return_output_handle); return(return_outputs); }
/// <summary> /// Create and return a new TF_Output for output_idx'th output of this op. /// </summary> public TF_Output _tf_output(int output_idx) { var tf_output = new TF_Output(op, output_idx); return(tf_output); }
public static extern int TF_GraphGetTensorNumDims(IntPtr graph, TF_Output output, SafeStatusHandle status);
public static extern void UpdateEdge(IntPtr graph, TF_Output new_src, TF_Input dst, IntPtr status);
public static extern void TF_GraphGetTensorShape(IntPtr graph, TF_Output output, long[] dims, int num_dims, IntPtr status);
public static extern int TF_GraphGetTensorNumDims(IntPtr graph, TF_Output output, IntPtr status);
public static extern void TF_ImportGraphDefOptionsAddInputMapping(IntPtr opts, string src_name, int src_index, TF_Output dst);
public static extern void TF_GraphSetOutputHandleShapesAndTypes(IntPtr graph, TF_Output output, int num_shapes_and_types, IntPtr[] shapes, int[] ranks, DataType[] types, SafeStatusHandle status);
public static extern void TF_UpdateEdge(IntPtr graph, TF_Output new_src, TF_Input dst, SafeStatusHandle status);
public static extern void TF_GraphSetTensorShape(IntPtr graph, TF_Output output, long[] dims, int num_dims, SafeStatusHandle status);
public static extern bool TF_TryEvaluateConstant(IntPtr graph, TF_Output output, IntPtr[] result, SafeStatusHandle status);
public static unsafe extern void TF_AddInput(TF_OperationDescription desc, TF_Output input);
public static extern void TF_AddInput(IntPtr desc, TF_Output input);
public static extern TF_DataType TF_OperationOutputType(TF_Output oper_out);
public static extern unsafe int TF_OperationOutputConsumers(TF_Output oper_out, IntPtr consumers, int max_consumers);
public static extern int TF_OperationOutputNumConsumers(TF_Output oper_out);