mirror of
https://github.com/huggingface/candle.git
synced 2025-06-18 19:47:12 +00:00
Backprop for conv2d. (#638)
* Start adding backprop for conv2d. * Backprop for conv2d. * Bugfix + start adding a conv2d test. * Conv2d backprop testing. * More conv fixes.
This commit is contained in:
@ -71,18 +71,14 @@ pub struct ParamsConvTranspose2D {
|
||||
impl ParamsConvTranspose2D {
|
||||
pub(crate) fn out_h(&self) -> usize {
|
||||
let dilation = 1;
|
||||
(self.i_h - 1) * self.stride - 2 * self.padding
|
||||
+ dilation * (self.k_h - 1)
|
||||
+ self.output_padding
|
||||
+ 1
|
||||
(self.i_h - 1) * self.stride + dilation * (self.k_h - 1) + self.output_padding + 1
|
||||
- 2 * self.padding
|
||||
}
|
||||
|
||||
pub(crate) fn out_w(&self) -> usize {
|
||||
let dilation = 1;
|
||||
(self.i_w - 1) * self.stride - 2 * self.padding
|
||||
+ dilation * (self.k_w - 1)
|
||||
+ self.output_padding
|
||||
+ 1
|
||||
(self.i_w - 1) * self.stride + dilation * (self.k_w - 1) + self.output_padding + 1
|
||||
- 2 * self.padding
|
||||
}
|
||||
|
||||
pub(crate) fn out_dims(&self) -> Vec<usize> {
|
||||
|
Reference in New Issue
Block a user