Document feedback

Question document fragment

When a question document fragment contains a formula, it is displayed as a space.

Submission type
issue

It's a little complicated...

I'd like to ask someone.

Please select the submission type

Problem type
Specifications and Common Mistakes

- Specifications and Common Mistakes:

- Misspellings or punctuation mistakes,incorrect formulas, abnormal display.

- Incorrect links, empty cells, or wrong formats.

- Chinese characters in English context.

- Minor inconsistencies between the UI and descriptions.

- Low writing fluency that does not affect understanding.

- Incorrect version numbers, including software package names and version numbers on the UI.

Usability

- Usability:

- Incorrect or missing key steps.

- Missing main function descriptions, keyword explanation, necessary prerequisites, or precautions.

- Ambiguous descriptions, unclear reference, or contradictory context.

- Unclear logic, such as missing classifications, items, and steps.

Correctness

- Correctness:

- Technical principles, function descriptions, supported platforms, parameter types, or exceptions inconsistent with that of software implementation.

- Incorrect schematic or architecture diagrams.

- Incorrect commands or command parameters.

- Incorrect code.

- Commands inconsistent with the functions.

- Wrong screenshots.

- Sample code running error, or running results inconsistent with the expectation.

Risk Warnings

- Risk Warnings:

- Lack of risk warnings for operations that may damage the system or important data.

Content Compliance

- Content Compliance:

- Contents that may violate applicable laws and regulations or geo-cultural context-sensitive words and expressions.

- Copyright infringement.

Please select the type of question

Problem description

Describe the bug so that we can quickly locate the problem.

mindspore.ops.ResizeBilinear

class mindspore.ops.ResizeBilinear(size, align_corners=False, half_pixel_centers=False)[source]

Resizes an image to a certain size using the bilinear interpolation.

The resizing only affects the lower two dimensions which represent the height and width. The input images can be represented by different data types, but the data types of output images are always float32.

For general resize, refer to mindspore.ops.interpolate() for more details.

Warning

This interface does not support dynamic shape and is subject to change or deletion, use mindspore.ops.interpolate() instead.

Parameters
  • size (Union[tuple[int], list[int]]) – A tuple or list of 2 int elements (new_height,new_width), the new size of the images.

  • align_corners (bool) – If true, rescale input by (new_height1)/(height1), which exactly aligns the 4 corners of images and resized images. If false, rescale by new_height/height. Default: False.

  • half_pixel_centers (bool) – Whether half pixel center. If set to True, align_corners should be False. Default: False.

Inputs:
  • x (Tensor) - Image to be resized. Input images must be a 4-D tensor with shape (batch,channels,height,width), with data type of float32 or float16.

Outputs:

Tensor, resized image. 4-D with shape (batch,channels,new_height,new_width), with the same data type as input x.

Raises
  • TypeError – If size is neither a tuple nor list.

  • TypeError – If align_corners is not a bool.

  • TypeError – If half_pixel_centers is not a bool.

  • TypeError – If align_corners and half_pixel_centers are all True.

  • TypeError – If half_pixel_centers is True and device_target not Ascend.

  • TypeError – If dtype of x is neither float16 nor float32.

  • TypeError – If x is not a Tensor.

  • ValueError – If length of shape of x is not equal to 4.

Supported Platforms:

Ascend CPU GPU

Examples

>>> x = Tensor([[[[1, 2, 3, 4, 5], [1, 2, 3, 4, 5]]]], mindspore.float32)
>>> resize_bilinear = ops.ResizeBilinear((5, 5))
>>> output = resize_bilinear(x)
>>> print(output)
[[[[1. 2. 3. 4. 5.]
   [1. 2. 3. 4. 5.]
   [1. 2. 3. 4. 5.]
   [1. 2. 3. 4. 5.]
   [1. 2. 3. 4. 5.]]]]