Browse Source

!6944 Fix input verification for input of GlobalbatchNorm.

Merge pull request !6944 from liuxiao93/GroupNorm
tags/v1.1.0
mindspore-ci-bot Gitee 5 years ago
parent
commit
24d1cc18a7
2 changed files with 11 additions and 10 deletions
  1. +1
    -1
      mindspore/nn/layer/normalization.py
  2. +10
    -9
      mindspore/ops/operations/nn_ops.py

+ 1
- 1
mindspore/nn/layer/normalization.py View File

@@ -628,7 +628,7 @@ class GroupNorm(Cell):
_channel_check(channel, self.num_channels)
x = self.reshape(x, (batch, self.num_groups, -1))
mean = self.reduce_mean(x, 2)
var = self.reduce_sum(self.square(x - mean), 2) / (channel * height * width / self.num_groups - 1)
var = self.reduce_sum(self.square(x - mean), 2) / (channel * height * width / self.num_groups)
std = self.sqrt(var + self.eps)
x = (x - mean) / std
x = self.reshape(x, (batch, channel, height, width))


+ 10
- 9
mindspore/ops/operations/nn_ops.py View File

@@ -5355,20 +5355,21 @@ class CTCGreedyDecoder(PrimitiveWithInfer):

Inputs:
- **inputs** (Tensor) - The input Tensor must be a `3-D` tensor whose shape is
:math:`(max_time, batch_size, num_classes)`. `num_classes` must be `num_labels + 1` classes, `num_labels`
indicates the number of actual labels. Blank labels are reserved. Default blank label is `num_classes - 1`.
Data type must be float32 or float64.
- **sequence_length** (Tensor) - A tensor containing sequence lengths with the shape of :math:`(batch_size)`.
The type must be int32. Each value in the tensor must not greater than `max_time`.
:math:`(\text{max_time}, \text{batch_size}, \text{num_classes})`. `num_classes` must be
`num_labels + 1` classes, `num_labels` indicates the number of actual labels. Blank labels are reserved.
Default blank label is `num_classes - 1`. Data type must be float32 or float64.
- **sequence_length** (Tensor) - A tensor containing sequence lengths with the shape of
:math:`(\text{batch_size})`. The type must be int32.
Each value in the tensor must not greater than `max_time`.

Outputs:
- **decoded_indices** (Tensor) - A tensor with shape of :math:`(total_decoded_outputs, 2)`.
- **decoded_indices** (Tensor) - A tensor with shape of :math:`(\text{total_decoded_outputs}, 2)`.
Data type is int64.
- **decoded_values** (Tensor) - A tensor with shape of :math:`(total_decoded_outputs)`,
- **decoded_values** (Tensor) - A tensor with shape of :math:`(\text{total_decoded_outputs})`,
it stores the decoded classes. Data type is int64.
- **decoded_shape** (Tensor) - The value of tensor is :math:`[batch_size, max_decoded_legth]`.
- **decoded_shape** (Tensor) - The value of tensor is :math:`[\text{batch_size}, \text{max_decoded_legth}]`.
Data type is int64.
- **log_probability** (Tensor) - A tensor with shape of :math:`(batch_size, 1)`,
- **log_probability** (Tensor) - A tensor with shape of :math:`(\text{batch_size}, 1)`,
containing sequence log-probability, has the same type as `inputs`.

Examples:


Loading…
Cancel
Save