Esempio n. 1
0
        public Tensor Transpose(Tensor x, params int[] dims)
        {
            if (dims.Length != x.DimCount)
            {
                throw new InvalidOperationException("The number of permutation indices must equal the number of tensor dimensions");
            }

            var result = In(x);

            foreach (var swap in SwapsForPermutation(dims))
            {
                var resultOld = result;
                result = C.TransposeAxes(result, new Axis(swap.Item1), new Axis(swap.Item2));
                resultOld.Dispose();
            }

            return(Out(result));
        }