コード例 #1
0
        /// <summary>
        /// 运行神经网络
        /// </summary>
        /// <param name="T">输入数据</param>
        /// <returns>输出Output层的输出</returns>
        public Tensor RunNetwork(Tensor T)
        {
            Tensor data = T;
            string link = "Input";

            for (int i = 0; i < Structure.Count; i++)
            {
                Layer <Tensor, LayerWB> layer = Structure[link];
                data = layer.Function(data);
                link = layer.LinkLayerName;
            }
            return(data);
        }
コード例 #2
0
        public Tensor RunForVariable(Tensor T, int LayerNumber)
        {
            Tensor data = T;
            string link = "Input";

            for (int i = 0; i < Structure.Count; i++)
            {
                Layer <Tensor, LayerWB> layer = Structure[link];
                data = layer.Function(data);
                if (layer.LayerNumber == LayerNumber)
                {
                    return(data);
                }
                link = layer.LinkLayerName;
            }
            return(data);
        }
コード例 #3
0
        public List <Tensor> RunNetwork_s(Tensor T)
        {
            List <Tensor> datas = new List <Tensor>()
            {
                T
            };
            string link = "Input";

            for (int i = 0; i < Structure.Count; i++)
            {
                Layer <Tensor, LayerWB> layer = Structure[link];
                datas.Add(layer.Function(datas[i]));
                link = layer.LinkLayerName;
            }
            datas.Remove(T);

            return(datas);
        }