mindelec.architecture.InputScaleNet
- class mindelec.architecture.InputScaleNet(input_scale, input_center=None)[source]
Scale the input value to specified region.
- Parameters
- Inputs:
input (Tensor) - Tensor of shape \((*, channels)\).
- Outputs:
Tensor of shape \((*, channels)\).
- Supported Platforms:
Ascend
Examples
>>> import numpy as np >>> from mindelec.architecture import InputScaleNet >>> 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 = InputScaleNet(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)