Total Complexity | 3 |
Total Lines | 16 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | #!/usr/bin/env python |
||
6 | class Bias(NeuralLayer): |
||
7 | """ |
||
8 | Bias layer. |
||
9 | """ |
||
10 | |||
11 | def __init__(self): |
||
12 | super(Bias, self).__init__("bias") |
||
13 | |||
14 | |||
15 | def prepare(self): |
||
16 | self.output_dim = self.input_dim |
||
17 | self.B = self.create_bias(self.output_dim, "bias") |
||
18 | self.register_parameters(self.B) |
||
19 | |||
20 | def compute_tensor(self, x): |
||
21 | return x + self.B |