Exemple #1
0
    def predict(self, inputs: Tensor) -> Tensor:
        # inputs will be (batch_size, 10)
        x1 = inputs @ self.w1 + self.b1  # (batch_size, num_hidden)
        x2 = tanh(x1)  # (batch_size, num_hidden)
        x3 = x2 @ self.w2 + self.b2  # (batch_size, 4)

        return x3
Exemple #2
0
    def forward(self, x: Tensor) -> Tensor:
        # inputs will be (batch_size, 10)
        x1 = x @ self.w1
        x1 = x1 + self.b1  # (batch_size, num_hidden)
        x2 = tanh(x1)  # (batch_size, num_hidden)
        x3 = x2 @ self.w2 + self.b2  # (batch_size, 4)

        return x3
Exemple #3
0
 def predict(self, inputs: Tensor) -> Tensor:
     x1 = inputs @ self.w1 + self.b1
     x2 = tanh(x1)
     x3 = x2 @ self.w2 + self.b2
     return x3