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.

PR

Just a small problem.

I can fix it online!

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.

mindflow.cell.InputScale

View Source On Gitee
class mindflow.cell.InputScale(input_scale, input_center=None)[source]

Scale the input value to specified region based on (xiinput_center)input_scale

Parameters
  • input_scale (list) – The scale factor of input.

  • input_center (Union[list, None]) – Position offset of coordinate translation. Default: None.

Inputs:
  • input (Tensor) - Tensor of shape (,channels).

Outputs:

Tensor of shape (,channels).

Raises
  • TypeError – If input_scale is not a list.

  • TypeError – If input_center is not a list or None.

Supported Platforms:

Ascend GPU

Examples

>>> import numpy as np
>>> from mindflow.cell import InputScale
>>> from mindspore import Tensor
>>> inputs = np.random.uniform(size=(16, 3)) + 3.0
>>> inputs = Tensor(inputs.astype(np.float32))
>>> input_scale = [1.0, 2.0, 4.0]
>>> input_center = [3.5, 3.5, 3.5]
>>> net = InputScale(input_scale, input_center)
>>> output = net(inputs).asnumpy()
>>> assert np.all(output[:, 0] <= 0.5) and np.all(output[:, 0] >= -0.5)
>>> assert np.all(output[:, 1] <= 1.0) and np.all(output[:, 0] >= -1.0)
>>> assert np.all(output[:, 2] <= 2.0) and np.all(output[:, 0] >= -2.0)