You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

mindspore.ops.Ones.rst 572 B

123456789101112131415161718192021
  1. mindspore.ops.Ones
  2. ===================
  3. .. py:class:: mindspore.ops.Ones
  4. 创建一个值全为1的Tensor。
  5. 第一个参数指定Tensor的shape,第二个参数指定填充值的数据类型。
  6. **输入:**
  7. - **shape** (Union[tuple[int], int]) - 指定输出Tensor的shape,只能是正整数常量。
  8. - **type** (mindspore.dtype) - 指定输出Tensor的数据类型,只能是常量值。
  9. **输出:**
  10. Tensor,shape和数据类型与输入相同。
  11. **异常:**
  12. - **TypeError** - `shape` 既不是tuple,也不是int。