示例#1
0
        /// <summary>
        /// Dummy解码
        /// </summary>
        /// <param name="t">要解码的数据</param>
        /// <returns>解码结果</returns>
        public override List <string> Decode(TensorOld t)
        {
            if (t.Rank != 2)
            {
                throw new TensorShapeException("one hot decode tensor.Rank must be 2!");
            }

            var result = new List <string>(t.shape[0]);
            var buff   = new double[t.shape[1]];

            for (int i = 0; i < t.shape[0]; i++)
            {
                t.GetByDim1(i, buff);
                var index = Dummy2Index(buff);
                result.Add(Categories[index]);
            }

            return(result);
        }