layers.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:pytorch_resnet 作者: taokong 项目源码 文件源码
def forward(self, x):
        """Return the deformed featured map"""

        x_shape = x.size()

        offsets = F.conv2d(x, self.weight, self.bias, self.stride,
                        self.padding, self.dilation, self.groups)

        # offsets: (b*c, h, w, 2)
        offsets = self._to_bc_h_w_2(offsets, x_shape)

        # x: (b*c, h, w)
        x = self._to_bc_h_w(x, x_shape)

        # X_offset: (b*c, h, w)
        x_offset = th_batch_map_offsets(x, offsets, grid=self._get_grid(self,x))

        # x_offset: (b, h, w, c)
        x_offset = self._to_b_c_h_w(x_offset, x_shape)

        return x_offset
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号