예제 #1
0
        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);
        }
예제 #2
0
        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]);
            }
        }
예제 #3
0
 protected ulong TF_TensorByteSize(SafeTensorHandle t)
 => c_api.TF_TensorByteSize(t);
예제 #4
0
 protected SafeEagerTensorHandle TFE_NewTensorHandle(SafeTensorHandle t, SafeStatusHandle status)
 => c_api.TFE_NewTensorHandle(t, status);
예제 #5
0
 protected IntPtr TF_TensorData(SafeTensorHandle t)
 => c_api.TF_TensorData(t);