!965 doc fix,add GlobalBN only support 2d and 4d

Merge pull request !965 from JichenZhao/globalbn_doc_fix
pull/965/MERGE
mindspore-ci-bot 5 years ago committed by Gitee
commit 8e06c2fe93

@ -355,6 +355,9 @@ class GlobalBatchNorm(_BatchNorm):
.. math:: .. math::
y = \frac{x - \mathrm{E}[x]}{\sqrt{\mathrm{Var}[x] + \epsilon}} * \gamma + \beta y = \frac{x - \mathrm{E}[x]}{\sqrt{\mathrm{Var}[x] + \epsilon}} * \gamma + \beta
Note:
Currently, GlobalBatchNorm only supports 2D and 4D inputs.
Args: Args:
num_features (int): `C` from an expected input of size (N, C, H, W). num_features (int): `C` from an expected input of size (N, C, H, W).
device_num_each_group (int): The number of devices in each group. device_num_each_group (int): The number of devices in each group.

@ -156,6 +156,7 @@ class AllGather(PrimitiveWithInfer):
self.add_prim_attr('group', _get_group(group)) self.add_prim_attr('group', _get_group(group))
def infer_shape(self, x_shape): def infer_shape(self, x_shape):
validator.check_integer("x shape", len(x_shape), 0, Rel.GT, self.name)
x_shape[0] = x_shape[0] * self.rank_size x_shape[0] = x_shape[0] * self.rank_size
return x_shape return x_shape

Loading…
Cancel
Save