コード例 #1
0
        /// <summary>
        /// Add the inputs to this operation description
        /// </summary>
        /// <param name="inputs">The inputs to the operation</param>
        public void AddInput(Output[] inputs)
        {
            IntPtr[] opPtrs  = new IntPtr[inputs.Length];
            int[]    indices = new int[inputs.Length];
            for (int i = 0; i < inputs.Length; i++)
            {
                opPtrs[i]  = inputs[i].Operation.Ptr;
                indices[i] = inputs[i].Index;
            }
            GCHandle opHandle  = GCHandle.Alloc(opPtrs, GCHandleType.Pinned);
            GCHandle idxHandle = GCHandle.Alloc(indices, GCHandleType.Pinned);

            TfInvoke.tfeAddInputList(_ptr, opHandle.AddrOfPinnedObject(), idxHandle.AddrOfPinnedObject(), inputs.Length);
            idxHandle.Free();
            opHandle.Free();
        }