Beispiel #1
0
        /// <summary>
        /// Copies a tensor calling each cell with a .Copy()
        ///
        /// O(V)
        /// </summary>
        public GenTensor <T> Copy(bool copyElements)
        {
            var res = new GenTensor <T>(Shape);

            if (!copyElements)
            {
                foreach (var index in res.IterateOverElements())
                {
                    res.SetValueNoCheck(ConstantsAndFunctions <T> .Forward(GetValueNoCheck(index)), index);
                }
            }
            else
            {
                foreach (var index in res.IterateOverElements())
                {
                    res.SetValueNoCheck(ConstantsAndFunctions <T> .Copy(GetValueNoCheck(index)), index);
                }
            }
            return(res);
        }