///<summary>Выполняет прямой проход через декодирующую нейросеть.</summary>
        ///<param name="input">Входные данные.</param>
        public Tensor Decode(Tensor input)
        {
            var Temp = input;

            Temp = Layers.Conv2D3x3(Temp, this.Data.Conv4_1_Weights, this.Data.Conv4_1_Biases);
            if (this.Step != null)
            {
                this.Step(100f / 20f);
            }
            Temp = Layers.ReLU(Temp);
            if (this.Step != null)
            {
                this.Step(100f / 20f);
            }
            Temp = Layers.Upsample2D(Temp);
            if (this.Step != null)
            {
                this.Step(100f / 20f);
            }
            Temp = Layers.Conv2D3x3(Temp, this.Data.Conv3_4_Weights, this.Data.Conv3_4_Biases);
            if (this.Step != null)
            {
                this.Step(100f / 20f);
            }
            Temp = Layers.ReLU(Temp);
            if (this.Step != null)
            {
                this.Step(100f / 20f);
            }
            Temp = Layers.Conv2D3x3(Temp, this.Data.Conv3_3_Weights, this.Data.Conv3_3_Biases);
            if (this.Step != null)
            {
                this.Step(100f / 20f);
            }
            Temp = Layers.ReLU(Temp);
            if (this.Step != null)
            {
                this.Step(100f / 20f);
            }
            Temp = Layers.Conv2D3x3(Temp, this.Data.Conv3_2_Weights, this.Data.Conv3_2_Biases);
            if (this.Step != null)
            {
                this.Step(100f / 20f);
            }
            Temp = Layers.ReLU(Temp);
            if (this.Step != null)
            {
                this.Step(100f / 20f);
            }
            Temp = Layers.Conv2D3x3(Temp, this.Data.Conv3_1_Weights, this.Data.Conv3_1_Biases);
            if (this.Step != null)
            {
                this.Step(100f / 20f);
            }
            Temp = Layers.ReLU(Temp);
            if (this.Step != null)
            {
                this.Step(100f / 20f);
            }
            Temp = Layers.Upsample2D(Temp);
            if (this.Step != null)
            {
                this.Step(100f / 20f);
            }
            Temp = Layers.Conv2D3x3(Temp, this.Data.Conv2_2_Weights, this.Data.Conv2_2_Biases);
            if (this.Step != null)
            {
                this.Step(100f / 20f);
            }
            Temp = Layers.ReLU(Temp);
            if (this.Step != null)
            {
                this.Step(100f / 20f);
            }
            Temp = Layers.Conv2D3x3(Temp, this.Data.Conv2_1_Weights, this.Data.Conv2_1_Biases);
            if (this.Step != null)
            {
                this.Step(100f / 20f);
            }
            Temp = Layers.ReLU(Temp);
            if (this.Step != null)
            {
                this.Step(100f / 20f);
            }
            Temp = Layers.Upsample2D(Temp);
            if (this.Step != null)
            {
                this.Step(100f / 20f);
            }
            Temp = Layers.Conv2D3x3(Temp, this.Data.Conv1_2_Weights, this.Data.Conv1_2_Biases);
            if (this.Step != null)
            {
                this.Step(100f / 20f);
            }
            Temp = Layers.ReLU(Temp);
            if (this.Step != null)
            {
                this.Step(100f / 20f);
            }
            Temp = Layers.Conv2D3x3(Temp, this.Data.Conv1_1_Weights, this.Data.Conv1_1_Biases);
            if (this.Step != null)
            {
                this.Step(100f / 20f);
            }
            return(Temp);
        }
        ///<summary>Выполняет прямой проход через декодирующую нейросеть.</summary>
        ///<param name="input">Входные данные.</param>
        public Tensor Decode(Tensor input)
        {
            var Temp = Layers.Conv2D(input, this.Data.Conv4_1_Weights, this.Data.Conv4_1_Biases);

            if (Step != null)
            {
                Step(5);
            }
            Temp = Layers.ReLU(Temp);
            if (Step != null)
            {
                Step(5);
            }
            Temp = Layers.Upsample2D(Temp);
            if (Step != null)
            {
                Step(5);
            }
            Temp = Layers.Conv2D(Temp, this.Data.Conv3_4_Weights, this.Data.Conv3_4_Biases);
            if (Step != null)
            {
                Step(5);
            }
            Temp = Layers.ReLU(Temp);
            if (Step != null)
            {
                Step(5);
            }
            Temp = Layers.Conv2D(Temp, this.Data.Conv3_3_Weights, this.Data.Conv3_3_Biases);
            if (Step != null)
            {
                Step(5);
            }
            Temp = Layers.ReLU(Temp);
            if (Step != null)
            {
                Step(5);
            }
            Temp = Layers.Conv2D(Temp, this.Data.Conv3_2_Weights, this.Data.Conv3_2_Biases);
            if (Step != null)
            {
                Step(5);
            }
            Temp = Layers.ReLU(Temp);
            if (Step != null)
            {
                Step(5);
            }
            Temp = Layers.Conv2D(Temp, this.Data.Conv3_1_Weights, this.Data.Conv3_1_Biases);
            if (Step != null)
            {
                Step(5);
            }
            Temp = Layers.ReLU(Temp);
            if (Step != null)
            {
                Step(5);
            }
            Temp = Layers.Upsample2D(Temp);
            if (Step != null)
            {
                Step(5);
            }
            Temp = Layers.Conv2D(Temp, this.Data.Conv2_2_Weights, this.Data.Conv2_2_Biases);
            if (Step != null)
            {
                Step(5);
            }
            Temp = Layers.ReLU(Temp);
            if (Step != null)
            {
                Step(5);
            }
            Temp = Layers.Conv2D(Temp, this.Data.Conv2_1_Weights, this.Data.Conv2_1_Biases);
            if (Step != null)
            {
                Step(5);
            }
            Temp = Layers.ReLU(Temp);
            if (Step != null)
            {
                Step(5);
            }
            Temp = Layers.Upsample2D(Temp);
            if (Step != null)
            {
                Step(5);
            }
            Temp = Layers.Conv2D(Temp, this.Data.Conv1_2_Weights, this.Data.Conv1_2_Biases);
            if (Step != null)
            {
                Step(5);
            }
            Temp = Layers.ReLU(Temp);
            if (Step != null)
            {
                Step(5);
            }
            Temp = Layers.Conv2D(Temp, this.Data.Conv1_1_Weights, this.Data.Conv1_1_Biases);
            if (Step != null)
            {
                Step(5);
            }
            Temp = Layers.ReLU(Temp);
            return(Temp);
        }
Exemplo n.º 3
0
        ///<summary>Выполняет прямой проход через декодирующую нейросеть.</summary>
        ///<param name="input">Входные данные.</param>
        public Tensor Decode(Tensor Content, Tensor Style)
        {
            var Temp = Layers.StyleSwap(Content, Style);

            if (this.Step != null)
            {
                this.Step(1f / 29f * 100f);
            }
            Temp = Layers.ConvTranspose2D(Temp, this.Data.TConv3_1_Weights, this.Data.TConv3_1_Biases, 1);
            if (this.Step != null)
            {
                this.Step(1f / 29f * 100f);
            }
            Temp = Layers.InstanceNorm2D(Temp, this.Data.TConv3_1_Shift, this.Data.TConv3_1_Scale);
            if (this.Step != null)
            {
                this.Step(1f / 29f * 100f);
            }
            Temp = Layers.ReLU(Temp);
            if (this.Step != null)
            {
                this.Step(1f / 29f * 100f);
            }
            Temp = Layers.ConvTranspose2D(Temp, this.Data.TConv2_4_Weights, this.Data.TConv2_4_Biases, 1);
            if (this.Step != null)
            {
                this.Step(1f / 29f * 100f);
            }
            Temp = Layers.InstanceNorm2D(Temp, this.Data.TConv2_4_Shift, this.Data.TConv2_4_Scale);
            if (this.Step != null)
            {
                this.Step(1f / 29f * 100f);
            }
            Temp = Layers.ReLU(Temp);
            if (this.Step != null)
            {
                this.Step(1f / 29f * 100f);
            }
            Temp = Layers.Upsample2D(Temp);
            if (this.Step != null)
            {
                this.Step(1f / 29f * 100f);
            }
            Temp = Layers.ConvTranspose2D(Temp, this.Data.TConv2_3_Weights, this.Data.TConv2_3_Biases, 1);
            if (this.Step != null)
            {
                this.Step(1f / 29f * 100f);
            }
            Temp = Layers.InstanceNorm2D(Temp, this.Data.TConv2_3_Shift, this.Data.TConv2_3_Scale);
            if (this.Step != null)
            {
                this.Step(1f / 29f * 100f);
            }
            Temp = Layers.ReLU(Temp);
            if (this.Step != null)
            {
                this.Step(1f / 29f * 100f);
            }
            Temp = Layers.ConvTranspose2D(Temp, this.Data.TConv2_2_Weights, this.Data.TConv2_2_Biases, 1);
            if (this.Step != null)
            {
                this.Step(1f / 29f * 100f);
            }
            Temp = Layers.InstanceNorm2D(Temp, this.Data.TConv2_2_Shift, this.Data.TConv2_2_Scale);
            if (this.Step != null)
            {
                this.Step(1f / 29f * 100f);
            }
            Temp = Layers.ReLU(Temp);
            if (this.Step != null)
            {
                this.Step(1f / 29f * 100f);
            }
            Temp = Layers.ConvTranspose2D(Temp, this.Data.TConv2_1_Weights, this.Data.TConv2_1_Biases, 1);
            if (this.Step != null)
            {
                this.Step(1f / 29f * 100f);
            }
            Temp = Layers.InstanceNorm2D(Temp, this.Data.TConv2_1_Shift, this.Data.TConv2_1_Scale);
            if (this.Step != null)
            {
                this.Step(1f / 29f * 100f);
            }
            Temp = Layers.ReLU(Temp);
            if (this.Step != null)
            {
                this.Step(1f / 29f * 100f);
            }
            Temp = Layers.ConvTranspose2D(Temp, this.Data.TConv1_4_Weights, this.Data.TConv1_4_Biases, 1);
            if (this.Step != null)
            {
                this.Step(1f / 29f * 100f);
            }
            Temp = Layers.InstanceNorm2D(Temp, this.Data.TConv1_4_Shift, this.Data.TConv1_4_Scale);
            if (this.Step != null)
            {
                this.Step(1f / 29f * 100f);
            }
            Temp = Layers.ReLU(Temp);
            if (this.Step != null)
            {
                this.Step(1f / 29f * 100f);
            }
            Temp = Layers.Upsample2D(Temp);
            if (this.Step != null)
            {
                this.Step(1f / 29f * 100f);
            }
            Temp = Layers.ConvTranspose2D(Temp, this.Data.TConv1_3_Weights, this.Data.TConv1_3_Biases, 1);
            if (this.Step != null)
            {
                this.Step(1f / 29f * 100f);
            }
            Temp = Layers.InstanceNorm2D(Temp, this.Data.TConv1_3_Shift, this.Data.TConv1_3_Scale);
            if (this.Step != null)
            {
                this.Step(1f / 29f * 100f);
            }
            Temp = Layers.ReLU(Temp);
            if (this.Step != null)
            {
                this.Step(1f / 29f * 100f);
            }
            Temp = Layers.ConvTranspose2D(Temp, this.Data.TConv1_2_Weights, this.Data.TConv1_2_Biases, 1);
            if (this.Step != null)
            {
                this.Step(1f / 29f * 100f);
            }
            Temp = Layers.InstanceNorm2D(Temp, this.Data.TConv1_2_Shift, this.Data.TConv1_2_Scale);
            if (this.Step != null)
            {
                this.Step(1f / 29f * 100f);
            }
            Temp = Layers.ReLU(Temp);
            if (this.Step != null)
            {
                this.Step(1f / 29f * 100f);
            }
            Temp = Layers.ConvTranspose2D(Temp, this.Data.TConv1_1_Weights, this.Data.TConv1_1_Biases, 1);
            if (this.Step != null)
            {
                this.Step(1f / 29f * 100f);
            }
            Temp = Layers.Sigmoid(Temp);
            if (this.Step != null)
            {
                this.Step(1f / 29f * 100f);
            }
            return(Temp);
        }
Exemplo n.º 4
0
        ///<summary>Выполняет прямой проход через кодирующую нейросеть.</summary>
        ///<param name="input">Входные данные.</param>
        public Tensor Encode(Tensor input)
        {
            var Temp = input;

            if ((this.Depth == EncoderType.Conv1) || (this.Depth == EncoderType.Conv2) || (this.Depth == EncoderType.Conv3) || (this.Depth == EncoderType.Conv4) || (this.Depth == EncoderType.Conv5))
            {
                Temp = Layers.Conv2D1x1(input, this.Data.Conv0_Weights, this.Data.Conv0_Biases);
                Temp = Layers.Conv2D3x3(Temp, this.Data.Conv1_1_Weights, this.Data.Conv1_1_Biases);
                if (Step != null)
                {
                    switch (this.Depth)
                    {
                    case EncoderType.Conv1:
                    {
                        Step(100f / 2f);
                        break;
                    }

                    case EncoderType.Conv2:
                    {
                        Step(100f / 7f);
                        break;
                    }

                    case EncoderType.Conv3:
                    {
                        Step(100f / 12f);
                        break;
                    }

                    case EncoderType.Conv4:
                    {
                        Step(100f / 21f);
                        break;
                    }

                    case EncoderType.Conv5:
                    {
                        Step(100f / 30f);
                        break;
                    }
                    }
                }
                Temp = Layers.ReLU(Temp);
                if (Step != null)
                {
                    switch (this.Depth)
                    {
                    case EncoderType.Conv1:
                    {
                        Step(100f / 2f);
                        break;
                    }

                    case EncoderType.Conv2:
                    {
                        Step(100f / 7f);
                        break;
                    }

                    case EncoderType.Conv3:
                    {
                        Step(100f / 12f);
                        break;
                    }

                    case EncoderType.Conv4:
                    {
                        Step(100f / 21f);
                        break;
                    }

                    case EncoderType.Conv5:
                    {
                        Step(100f / 30f);
                        break;
                    }
                    }
                }
            }
            if ((this.Depth == EncoderType.Conv2) || (this.Depth == EncoderType.Conv3) || (this.Depth == EncoderType.Conv4) || (this.Depth == EncoderType.Conv5))
            {
                Temp = Layers.Conv2D3x3(Temp, this.Data.Conv1_2_Weights, this.Data.Conv1_2_Biases);
                if (Step != null)
                {
                    switch (this.Depth)
                    {
                    case EncoderType.Conv2:
                    {
                        Step(100f / 7f);
                        break;
                    }

                    case EncoderType.Conv3:
                    {
                        Step(100f / 12f);
                        break;
                    }

                    case EncoderType.Conv4:
                    {
                        Step(100f / 21f);
                        break;
                    }

                    case EncoderType.Conv5:
                    {
                        Step(100f / 30f);
                        break;
                    }
                    }
                }
                Temp = Layers.ReLU(Temp);
                if (Step != null)
                {
                    switch (this.Depth)
                    {
                    case EncoderType.Conv2:
                    {
                        Step(100f / 7f);
                        break;
                    }

                    case EncoderType.Conv3:
                    {
                        Step(100f / 12f);
                        break;
                    }

                    case EncoderType.Conv4:
                    {
                        Step(100f / 21f);
                        break;
                    }

                    case EncoderType.Conv5:
                    {
                        Step(100f / 30f);
                        break;
                    }
                    }
                }
                Temp = Layers.MaxPool2D(Temp);
                if (Step != null)
                {
                    switch (this.Depth)
                    {
                    case EncoderType.Conv2:
                    {
                        Step(100f / 7f);
                        break;
                    }

                    case EncoderType.Conv3:
                    {
                        Step(100f / 12f);
                        break;
                    }

                    case EncoderType.Conv4:
                    {
                        Step(100f / 21f);
                        break;
                    }

                    case EncoderType.Conv5:
                    {
                        Step(100f / 30f);
                        break;
                    }
                    }
                }
                Temp = Layers.Conv2D3x3(Temp, this.Data.Conv2_1_Weights, this.Data.Conv2_1_Biases);
                if (Step != null)
                {
                    switch (this.Depth)
                    {
                    case EncoderType.Conv2:
                    {
                        Step(100f / 7f);
                        break;
                    }

                    case EncoderType.Conv3:
                    {
                        Step(100f / 12f);
                        break;
                    }

                    case EncoderType.Conv4:
                    {
                        Step(100f / 21f);
                        break;
                    }

                    case EncoderType.Conv5:
                    {
                        Step(100f / 30f);
                        break;
                    }
                    }
                }
                Temp = Layers.ReLU(Temp);
                if (Step != null)
                {
                    switch (this.Depth)
                    {
                    case EncoderType.Conv2:
                    {
                        Step(100f / 7f);
                        break;
                    }

                    case EncoderType.Conv3:
                    {
                        Step(100f / 12f);
                        break;
                    }

                    case EncoderType.Conv4:
                    {
                        Step(100f / 21f);
                        break;
                    }

                    case EncoderType.Conv5:
                    {
                        Step(100f / 30f);
                        break;
                    }
                    }
                }
            }
            if ((this.Depth == EncoderType.Conv3) || (this.Depth == EncoderType.Conv4) || (this.Depth == EncoderType.Conv5))
            {
                Temp = Layers.Conv2D3x3(Temp, this.Data.Conv2_2_Weights, this.Data.Conv2_2_Biases);
                if (Step != null)
                {
                    switch (this.Depth)
                    {
                    case EncoderType.Conv3:
                    {
                        Step(100f / 12f);
                        break;
                    }

                    case EncoderType.Conv4:
                    {
                        Step(100f / 21f);
                        break;
                    }

                    case EncoderType.Conv5:
                    {
                        Step(100f / 30f);
                        break;
                    }
                    }
                }
                Temp = Layers.ReLU(Temp);
                if (Step != null)
                {
                    switch (this.Depth)
                    {
                    case EncoderType.Conv3:
                    {
                        Step(100f / 12f);
                        break;
                    }

                    case EncoderType.Conv4:
                    {
                        Step(100f / 21f);
                        break;
                    }

                    case EncoderType.Conv5:
                    {
                        Step(100f / 30f);
                        break;
                    }
                    }
                }
                Temp = Layers.MaxPool2D(Temp);
                if (Step != null)
                {
                    switch (this.Depth)
                    {
                    case EncoderType.Conv3:
                    {
                        Step(100f / 12f);
                        break;
                    }

                    case EncoderType.Conv4:
                    {
                        Step(100f / 21f);
                        break;
                    }

                    case EncoderType.Conv5:
                    {
                        Step(100f / 30f);
                        break;
                    }
                    }
                }
                Temp = Layers.Conv2D3x3(Temp, this.Data.Conv3_1_Weights, this.Data.Conv3_1_Biases);
                if (Step != null)
                {
                    switch (this.Depth)
                    {
                    case EncoderType.Conv3:
                    {
                        Step(100f / 12f);
                        break;
                    }

                    case EncoderType.Conv4:
                    {
                        Step(100f / 21f);
                        break;
                    }

                    case EncoderType.Conv5:
                    {
                        Step(100f / 30f);
                        break;
                    }
                    }
                }
                Temp = Layers.ReLU(Temp);
                if (Step != null)
                {
                    switch (this.Depth)
                    {
                    case EncoderType.Conv3:
                    {
                        Step(100f / 12f);
                        break;
                    }

                    case EncoderType.Conv4:
                    {
                        Step(100f / 21f);
                        break;
                    }

                    case EncoderType.Conv5:
                    {
                        Step(100f / 30f);
                        break;
                    }
                    }
                }
            }
            if ((this.Depth == EncoderType.Conv4) || (this.Depth == EncoderType.Conv5))
            {
                Temp = Layers.Conv2D3x3(Temp, this.Data.Conv3_2_Weights, this.Data.Conv3_2_Biases);
                if (Step != null)
                {
                    switch (this.Depth)
                    {
                    case EncoderType.Conv4:
                    {
                        Step(100f / 21f);
                        break;
                    }

                    case EncoderType.Conv5:
                    {
                        Step(100f / 30f);
                        break;
                    }
                    }
                }
                Temp = Layers.ReLU(Temp);
                if (Step != null)
                {
                    switch (this.Depth)
                    {
                    case EncoderType.Conv4:
                    {
                        Step(100f / 21f);
                        break;
                    }

                    case EncoderType.Conv5:
                    {
                        Step(100f / 30f);
                        break;
                    }
                    }
                }
                Temp = Layers.Conv2D3x3(Temp, this.Data.Conv3_3_Weights, this.Data.Conv3_3_Biases);
                if (Step != null)
                {
                    switch (this.Depth)
                    {
                    case EncoderType.Conv4:
                    {
                        Step(100f / 21f);
                        break;
                    }

                    case EncoderType.Conv5:
                    {
                        Step(100f / 30f);
                        break;
                    }
                    }
                }
                Temp = Layers.ReLU(Temp);
                if (Step != null)
                {
                    switch (this.Depth)
                    {
                    case EncoderType.Conv4:
                    {
                        Step(100f / 21f);
                        break;
                    }

                    case EncoderType.Conv5:
                    {
                        Step(100f / 30f);
                        break;
                    }
                    }
                }
                Temp = Layers.Conv2D3x3(Temp, this.Data.Conv3_4_Weights, this.Data.Conv3_4_Biases);
                if (Step != null)
                {
                    switch (this.Depth)
                    {
                    case EncoderType.Conv4:
                    {
                        Step(100f / 21f);
                        break;
                    }

                    case EncoderType.Conv5:
                    {
                        Step(100f / 30f);
                        break;
                    }
                    }
                }
                Temp = Layers.ReLU(Temp);
                if (Step != null)
                {
                    switch (this.Depth)
                    {
                    case EncoderType.Conv4:
                    {
                        Step(100f / 21f);
                        break;
                    }

                    case EncoderType.Conv5:
                    {
                        Step(100f / 30f);
                        break;
                    }
                    }
                }
                Temp = Layers.MaxPool2D(Temp);
                if (Step != null)
                {
                    switch (this.Depth)
                    {
                    case EncoderType.Conv4:
                    {
                        Step(100f / 21f);
                        break;
                    }

                    case EncoderType.Conv5:
                    {
                        Step(100f / 30f);
                        break;
                    }
                    }
                }
                Temp = Layers.Conv2D3x3(Temp, this.Data.Conv4_1_Weights, this.Data.Conv4_1_Biases);
                if (Step != null)
                {
                    switch (this.Depth)
                    {
                    case EncoderType.Conv4:
                    {
                        Step(100f / 21f);
                        break;
                    }

                    case EncoderType.Conv5:
                    {
                        Step(100f / 30f);
                        break;
                    }
                    }
                }
                Temp = Layers.ReLU(Temp);
                if (Step != null)
                {
                    switch (this.Depth)
                    {
                    case EncoderType.Conv4:
                    {
                        Step(100f / 21f);
                        break;
                    }

                    case EncoderType.Conv5:
                    {
                        Step(100f / 30f);
                        break;
                    }
                    }
                }
            }
            if (this.Depth == EncoderType.Conv5)
            {
                Temp = Layers.Conv2D3x3(Temp, this.Data.Conv4_2_Weights, this.Data.Conv4_2_Biases);
                if (Step != null)
                {
                    Step(100f / 30f);
                }
                Temp = Layers.ReLU(Temp);
                if (Step != null)
                {
                    Step(100f / 30f);
                }
                Temp = Layers.Conv2D3x3(Temp, this.Data.Conv4_3_Weights, this.Data.Conv4_3_Biases);
                if (Step != null)
                {
                    Step(100f / 30f);
                }
                Temp = Layers.ReLU(Temp);
                if (Step != null)
                {
                    Step(100f / 30f);
                }
                Temp = Layers.Conv2D3x3(Temp, this.Data.Conv4_4_Weights, this.Data.Conv4_4_Biases);
                if (Step != null)
                {
                    Step(100f / 30f);
                }
                Temp = Layers.ReLU(Temp);
                if (Step != null)
                {
                    Step(100f / 30f);
                }
                Temp = Layers.MaxPool2D(Temp);
                if (Step != null)
                {
                    Step(100f / 30f);
                }
                Temp = Layers.Conv2D3x3(Temp, this.Data.Conv5_1_Weights, this.Data.Conv5_1_Biases);
                if (Step != null)
                {
                    Step(100f / 30f);
                }
                Temp = Layers.ReLU(Temp);
                if (Step != null)
                {
                    Step(100f / 30f);
                }
            }
            return(Temp);
        }
        ///<summary>Выполняет прямой проход через кодирующую нейросеть.</summary>
        ///<param name="input">Входные данные.</param>
        public Tensor Encode(Tensor input)
        {
            var Temp = input;

            Temp = Layers.Conv2D3x3(Temp, this.Data.Conv1_1_Weights, this.Data.Conv1_1_Biases);
            if (this.Step != null)
            {
                this.Step(5f);
            }
            Temp = Layers.ReLU(Temp);
            if (this.Step != null)
            {
                this.Step(5f);
            }
            Temp = Layers.Conv2D3x3(Temp, this.Data.Conv1_2_Weights, this.Data.Conv1_2_Biases);
            if (this.Step != null)
            {
                this.Step(5f);
            }
            Temp = Layers.ReLU(Temp);
            if (this.Step != null)
            {
                this.Step(5f);
            }
            Temp = Layers.AvgPool2D(Temp);
            if (this.Step != null)
            {
                this.Step(5f);
            }
            Temp = Layers.Conv2D3x3(Temp, this.Data.Conv2_1_Weights, this.Data.Conv2_1_Biases);
            if (this.Step != null)
            {
                this.Step(5f);
            }
            Temp = Layers.ReLU(Temp);
            if (this.Step != null)
            {
                this.Step(5f);
            }
            Temp = Layers.Conv2D3x3(Temp, this.Data.Conv2_2_Weights, this.Data.Conv2_2_Biases);
            if (this.Step != null)
            {
                this.Step(5f);
            }
            Temp = Layers.ReLU(Temp);
            if (this.Step != null)
            {
                this.Step(5f);
            }
            Temp = Layers.AvgPool2D(Temp);
            if (this.Step != null)
            {
                //this.Step(5f);
            }
            Temp = Layers.Conv2D3x3(Temp, this.Data.Conv3_1_Weights, this.Data.Conv3_1_Biases);
            if (this.Step != null)
            {
                this.Step(5f);
            }
            Temp = Layers.ReLU(Temp);
            if (this.Step != null)
            {
                this.Step(5f);
            }
            Temp = Layers.Conv2D3x3(Temp, this.Data.Conv3_2_Weights, this.Data.Conv3_2_Biases);
            if (this.Step != null)
            {
                this.Step(5f);
            }
            Temp = Layers.ReLU(Temp);
            if (this.Step != null)
            {
                this.Step(5f);
            }
            Temp = Layers.Conv2D3x3(Temp, this.Data.Conv3_3_Weights, this.Data.Conv3_3_Biases);
            if (this.Step != null)
            {
                this.Step(5f);
            }
            Temp = Layers.ReLU(Temp);
            if (this.Step != null)
            {
                this.Step(5f);
            }
            Temp = Layers.Conv2D3x3(Temp, this.Data.Conv3_4_Weights, this.Data.Conv3_4_Biases);
            if (this.Step != null)
            {
                this.Step(5f);
            }
            Temp = Layers.ReLU(Temp);
            if (this.Step != null)
            {
                this.Step(5f);
            }
            Temp = Layers.AvgPool2D(Temp);
            if (this.Step != null)
            {
                this.Step(5f);
            }
            Temp = Layers.Conv2D3x3(Temp, this.Data.Conv4_1_Weights, this.Data.Conv4_1_Biases);
            if (this.Step != null)
            {
                this.Step(5f);
            }
            Temp = Layers.ReLU(Temp);
            if (this.Step != null)
            {
                this.Step(5f);
            }
            return(Temp);
        }
        ///<summary>Выполняет прямой проход через кодирующую нейросеть.</summary>
        ///<param name="input">Входные данные.</param>
        public Tensor[] EncodeStyle(Tensor input)
        {
            var Temp = input;

            Temp = Layers.Conv2D3x3(Temp, this.Data.Conv1_1_Weights, this.Data.Conv1_1_Biases);
            if (this.Step != null)
            {
                this.Step(5f);
            }
            Temp = Layers.ReLU(Temp);
            var Conv1 = Temp;

            if (this.Step != null)
            {
                this.Step(5f);
            }
            Temp = Layers.Conv2D3x3(Temp, this.Data.Conv1_2_Weights, this.Data.Conv1_2_Biases);
            if (this.Step != null)
            {
                this.Step(5f);
            }
            Temp = Layers.ReLU(Temp);
            if (this.Step != null)
            {
                this.Step(5f);
            }
            Temp = Layers.AvgPool2D(Temp);
            if (this.Step != null)
            {
                this.Step(5f);
            }
            Temp = Layers.Conv2D3x3(Temp, this.Data.Conv2_1_Weights, this.Data.Conv2_1_Biases);
            if (this.Step != null)
            {
                this.Step(5f);
            }
            Temp = Layers.ReLU(Temp);
            var Conv2 = Temp;

            if (this.Step != null)
            {
                this.Step(5f);
            }
            Temp = Layers.Conv2D3x3(Temp, this.Data.Conv2_2_Weights, this.Data.Conv2_2_Biases);
            if (this.Step != null)
            {
                this.Step(5f);
            }
            Temp = Layers.ReLU(Temp);
            if (this.Step != null)
            {
                this.Step(5f);
            }
            Temp = Layers.AvgPool2D(Temp);
            if (this.Step != null)
            {
                //this.Step(5f);
            }
            Temp = Layers.Conv2D3x3(Temp, this.Data.Conv3_1_Weights, this.Data.Conv3_1_Biases);
            if (this.Step != null)
            {
                this.Step(5f);
            }
            Temp = Layers.ReLU(Temp);
            var Conv3 = Temp;

            if (this.Step != null)
            {
                this.Step(5f);
            }
            Temp = Layers.Conv2D3x3(Temp, this.Data.Conv3_2_Weights, this.Data.Conv3_2_Biases);
            if (this.Step != null)
            {
                this.Step(5f);
            }
            Temp = Layers.ReLU(Temp);
            if (this.Step != null)
            {
                this.Step(5f);
            }
            Temp = Layers.Conv2D3x3(Temp, this.Data.Conv3_3_Weights, this.Data.Conv3_3_Biases);
            if (this.Step != null)
            {
                this.Step(5f);
            }
            Temp = Layers.ReLU(Temp);
            if (this.Step != null)
            {
                this.Step(5f);
            }
            Temp = Layers.Conv2D3x3(Temp, this.Data.Conv3_4_Weights, this.Data.Conv3_4_Biases);
            if (this.Step != null)
            {
                this.Step(5f);
            }
            Temp = Layers.ReLU(Temp);
            if (this.Step != null)
            {
                this.Step(5f);
            }
            Temp = Layers.AvgPool2D(Temp);
            if (this.Step != null)
            {
                this.Step(5f);
            }
            Temp = Layers.Conv2D3x3(Temp, this.Data.Conv4_1_Weights, this.Data.Conv4_1_Biases);
            if (this.Step != null)
            {
                this.Step(5f);
            }
            Temp = Layers.ReLU(Temp);
            var Conv4 = Temp;

            if (this.Step != null)
            {
                this.Step(5f);
            }
            return(new Tensor[4] {
                Conv1, Conv2, Conv3, Conv4
            });
        }