Browse Source

!9209 Delete sequence mask function and fix comment in Interpolate function.

From: @liangzhibo
Reviewed-by: @zh_qh,@chenfei52,@ginfung
Signed-off-by: @zh_qh
tags/v1.1.0
mindspore-ci-bot Gitee 5 years ago
parent
commit
053bcd0266
3 changed files with 9 additions and 22 deletions
  1. +9
    -11
      mindspore/nn/layer/basic.py
  2. +0
    -10
      mindspore/ops/_grad/grad_array_ops.py
  3. +0
    -1
      mindspore/ops/operations/__init__.py

+ 9
- 11
mindspore/nn/layer/basic.py View File

@@ -589,17 +589,15 @@ class Interpolate(Cell):
Samples the input tensor to the given size or scale_factor. Now, only support
bilinear interpolation.

Args:
size (Union[tuple[int], list[int]]): A tuple or list of 2 int elements '(new_height, new_width)',
the new size of the tensor. Default: None.
scale_factor (int): The scale factor of new size of the tensor. The value should be positive integer.
Default: None.
align_corners (bool): If true, rescale input by '(new_height - 1) / (height - 1)', which exactly aligns
the 4 corners of images and resized images. If false, rescale by 'new_height / height'. Default: False.

Inputs:
- **x** (Tensor) - Tensor to be resized. Input tensor must be a 4-D tensor with shape:
math:`(batch, channels, height, width)`, with data type of float16 or float32.
- **size** (Union[tuple[int], list[int]]): A tuple or list of 2 int elements '(new_height, new_width)',
the new size of the tensor. One and only one of size and scale_factor can be set to None. Default: None.
- **scale_factor** (int): The scale factor of new size of the tensor. The value should be positive integer.
One and only one of size and scale_factor can be set to None. Default: None.
- **align_corners** (bool): If true, rescale input by '(new_height - 1) / (height - 1)', which exactly aligns
the 4 corners of images and resized images. If false, rescale by 'new_height / height'. Default: False.

Outputs:
Resized tensor.
@@ -609,14 +607,14 @@ class Interpolate(Cell):
scale_factor * width)` in float32

Supported Platforms:
``Ascend`` ``GPU`` ``CPU``
``Ascend``

Examples:
>>> from mindspore.ops import operations as P
>>> tensor = Tensor([[[[1, 2, 3, 4], [5, 6, 7, 8]]]], mindspore.float32)
>>> interpolate = nn.Interpolate()
>>> result = interpolate(tensor, size=(5,5))
>>> assert result.shape == (1, 1, 5, 5)
>>> print(result.shape)
(1, 1, 5, 5)
"""
def __init__(self):
super(Interpolate, self).__init__()


+ 0
- 10
mindspore/ops/_grad/grad_array_ops.py View File

@@ -71,16 +71,6 @@ def get_bprop_zeros(self):
return bprop


@bprop_getters.register(P.SequenceMask)
def get_bprop_sequence_mask(self):
"""Generate bprop for SequenceMask"""

def bprop(lengths, dtype, max_length, out, dout):
return zeros_like(dims), zeros_like(max_length)

return bprop


@bprop_getters.register(P.DType)
def get_bprop_dtype(self):
"""Generate bprop for DType"""


+ 0
- 1
mindspore/ops/operations/__init__.py View File

@@ -184,7 +184,6 @@ __all__ = [
'Fill',
'Ones',
'Zeros',
'SequenceMask',
'OnesLike',
'ZerosLike',
'Select',


Loading…
Cancel
Save