maxframe.tensor.isreal#
- maxframe.tensor.isreal(x, **kwargs)[源代码]#
返回一个布尔张量,如果输入元素是实数则为 True。
如果元素具有复数类型且虚部为零,则该元素的返回值为 True。
- 参数:
x (array_like) -- 输入张量。
- 返回:
out -- 与 x 形状相同的布尔张量。
- 返回类型:
Tensor, bool
示例
>>> import maxframe.tensor as mt
>>> mt.isreal([1+1j, 1+0j, 4.5, 3, 2, 2j]).execute() array([False, True, True, True, True, False])