(in_ch: usize, out_ch: usize, kernel: usize, padding: usize, vb: VarBuilder)
| 21 | |
| 22 | impl RawConv2d { |
| 23 | fn load(in_ch: usize, out_ch: usize, kernel: usize, padding: usize, vb: VarBuilder) -> Result<Self> { |
| 24 | let weight = vb.get((out_ch, in_ch, kernel, kernel), "weight")?; |
| 25 | let bias = vb.get(out_ch, "bias").ok(); |
| 26 | Ok(Self { weight, bias, padding }) |
| 27 | } |
| 28 | |
| 29 | fn forward(&self, x: &Tensor, backend: &dyn ComputeBackend) -> Result<Tensor> { |
| 30 | backend.conv2d(x, &self.weight, self.bias.as_ref(), self.padding, 1, 1, 1) |