void NewEagerTensorHandle(SafeTensorHandle h) { _id = ops.uid(); _eagerTensorHandle = c_api.TFE_NewTensorHandle(h, tf.Status.Handle); #if TRACK_TENSOR_LIFE Console.WriteLine($"New EagerTensor {_eagerTensorHandle}"); #endif tf.Status.Check(true); }
public unsafe void Run(Status s) { var inputs_ptr = inputs_.ToArray(); var input_values_ptr = input_values_.Select(x => x.Handle.DangerousGetHandle()).ToArray(); var outputs_ptr = outputs_.ToArray(); var output_values_ptr = output_values_.Select(x => IntPtr.Zero).ToArray(); IntPtr[] targets_ptr = new IntPtr[0]; c_api.TF_SessionRun(session_, null, inputs_ptr, input_values_ptr, inputs_ptr.Length, outputs_ptr, output_values_ptr, outputs_.Count, targets_ptr, targets_.Count, IntPtr.Zero, s.Handle); s.Check(); for (var i = 0; i < outputs_.Count; i++) { output_values_[i] = new SafeTensorHandle(output_values_ptr[i]); } }
protected ulong TF_TensorByteSize(SafeTensorHandle t) => c_api.TF_TensorByteSize(t);
protected SafeEagerTensorHandle TFE_NewTensorHandle(SafeTensorHandle t, SafeStatusHandle status) => c_api.TFE_NewTensorHandle(t, status);
protected IntPtr TF_TensorData(SafeTensorHandle t) => c_api.TF_TensorData(t);