Esempio n. 1
0
        public void Init(int height, int width)
        {
            Input.Init(new Vector3Int(height, width, Input.InputChannels));
#if !DEBUG_LAYER
            for (int i = 1; i < Layers.Count; i++)
#else
            for (int i = 1; i < debug_layer + 1; i++)
#endif
            {
                if (Layers[i] is Concatenate)
                {
                    Vector3Int input1 = Layers[i - 1].OutputShape;
                    Vector3Int input2 = Layers[(Layers[i] as Concatenate).AlternativeInputId].OutputShape;
                    Layers[i].Init(new Vector3Int(input1.x, input1.y, input1.z + input2.z));
                }
                else
                {
                    Layers[i].Init(Layers[i - 1].OutputShape);
                }
            }
#if !DEBUG_LAYER
            Output.Init(Layers[Layers.Count - 1].OutputShape);
#else
            Output.Init(Layers[debug_layer].OutputShape);
#endif
        }
Esempio n. 2
0
        public void Init(int height, int width)
        {
            Input.Init(new Vector3Int(height, width, Input.InputChannels));

#if !DEBUG_LAYER
            for (int i = 1; i < Layers.Count; i++)
#else
            for (int i = 1; i < debug_layer + 1; i++)
#endif
            {
                if (Layers[i] is Concatenate)
                {
                    Vector3Int input1 = Layers[i - 1].OutputShape;
                    Vector3Int input2 = Layers[(Layers[i] as Concatenate).AlternativeInputId].OutputShape;
                    (Layers[i] as Concatenate).kernal_last_layer = input1.z;
                    (Layers[i] as Concatenate).kernal_down_layer = input2.z;
                    Layers[i].Init(new Vector3Int(input1.x, input1.y, input1.z + input2.z));
                }
                else if (Layers[i] is UpSampling2D)
                {
                    int aid = (Layers[i] as UpSampling2D).AlternativeInputId;
                    if (aid > 0)
                    {
                        (Layers[i] as UpSampling2D).DownShape = new Vector3Int(
                            Layers[aid].OutputShape.x,
                            Layers[aid].OutputShape.y,
                            Layers[i - 1].OutputShape.z);

                        Layers[i].Init(new Vector3Int(
                                           Layers[i - 1].OutputShape.x,
                                           Layers[i - 1].OutputShape.y,
                                           Layers[i - 1].OutputShape.z));
                    }
                    else
                    {
                        Layers[i].Init(new Vector3Int(
                                           Layers[i - 1].OutputShape.x,
                                           Layers[i - 1].OutputShape.y,
                                           Layers[i - 1].OutputShape.z));
                    }
                }
                else
                {
                    Layers[i].Init(Layers[i - 1].OutputShape);
                }
            }
#if !DEBUG_LAYER
            //Output.Init(Layers[Layers.Count - 1].OutputShape);  // 这一层为什么要单独init ?
            Output.Init(Layers[debug_layer].OutputShape);
            //int a = 0;
            //Debug.Init(Layers[0].OutputShape);
#else
            Output.Init(Layers[debug_layer].OutputShape);
#endif
        }