mindspore.ops.ldexp
- mindspore.ops.ldexp(x, other)[source]
Multiplies input tensor by \(2^{other}\) element-wise.
Typically this function is used to construct floating point numbers by multiplying mantissas in x with integral powers of two created from the exponents in other:
\[out_{i} = x_{i} * ( 2 ^{other_{i}} )\]- Parameters
- Returns
Tensor
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> import mindspore >>> x = mindspore.tensor([1.], mindspore.float32) >>> other = mindspore.tensor([1, 2, 3, 4], mindspore.int32) >>> out = mindspore.ops.ldexp(x, other) >>> print(out) [ 2. 4. 8. 16.] >>> x = mindspore.tensor([[1.], [2]], mindspore.float32) >>> other = mindspore.tensor([[1.], [2]], mindspore.int32) >>> out = mindspore.ops.ldexp(x, other) >>> print(out) [[2.] [8.]]