Exemplo n.º 1
0
        /// <summary>
        /// Returns the shape of the Tensor
        /// </summary>
        /// <param name="output">The output</param>
        /// <param name="numDim">The rank of the tensor</param>
        /// <param name="status">The status</param>
        /// <returns>The shape of the Tensor</returns>
        public int[] GetTensorShape(Output output, int numDim, Status status = null)
        {
            int[]    dims   = new int[numDim];
            GCHandle handle = GCHandle.Alloc(dims, GCHandleType.Pinned);

            using (StatusChecker checker = new StatusChecker(status))
                TfInvoke.tfeGraphGetTensorShape(_ptr, output.Operation, output.Index, handle.AddrOfPinnedObject(), numDim, checker.Status);
            handle.Free();
            return(dims);
        }