///<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 }); }