Skip to content

Commit

Permalink
add
Browse files Browse the repository at this point in the history
  • Loading branch information
vivienfanghuagood committed Jan 6, 2025
1 parent 505e048 commit cbdd518
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions ppocr/modeling/backbones/rec_resnetv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@ def __init__(
self.export = is_export
self.eps = eps

running_mean = paddle.zeros([self._out_channels], dtype="float32")
running_variance = paddle.ones([self._out_channels], dtype="float32")
self.running_mean = paddle.zeros([self._out_channels], dtype="float32")
self.running_variance = paddle.ones([self._out_channels], dtype="float32")
orin_shape = self.weight.shape

new_weight = F.batch_norm(
self.weight.reshape([1, self._out_channels, -1]),
running_mean,
running_variance,
self.running_mean,
self.running_variance,
momentum=0.0,
epsilon=self.eps,
use_global_stats=False,
Expand All @@ -116,8 +116,8 @@ def forward(self, x):
weight = paddle.reshape(
F.batch_norm(
self.weight.reshape([1, self._out_channels, -1]),
running_mean,
running_variance,
self.running_mean,
self.running_variance,
training=True,
momentum=0.0,
epsilon=self.eps,
Expand Down

0 comments on commit cbdd518

Please sign in to comment.