mindspore.ops.NPUGetFloatStatus
- class mindspore.ops.NPUGetFloatStatus[source]
Updates the flag which is the output tensor of NPUAllocFloatStatus with the latest overflow status.
The flag is a tensor whose shape is (8,) and data type is mindspore.dtype.float32. If the sum of the flag equals to 0, there is no overflow happened. If the sum of the flag is bigger than 0, there is overflow happened. In addition, there are strict sequencing requirements for use, i.e., before using the NPUGetFloatStatus operator, need to ensure that the NPUClearFlotStatus and your compute has been executed. We use Depend to ensure the execution order.
- Inputs:
x (Tensor) - The output tensor of NPUAllocFloatStatus. The data type must be float16 or float32. \((N,*)\) where \(*\) means, any number of additional dimensions, its rank should less than 8.
- Outputs:
Tensor, has the same shape as x. All the elements in the tensor will be zero.
- Supported Platforms:
Ascend
Examples
>>> self.alloc_status = ops.NPUAllocFloatStatus() >>> self.get_status = ops.NPUGetFloatStatus() >>> self.clear_status = ops.NPUClearFloatStatus() >>> init = self.alloc_status() >>> init = F.Depend(init, input) # Ensure clear_status after input >>> clear_status = self.clear_status(init) >>> input = F.Depend(input, clear_status) # Ensure your compute after clear_status >>> output = Compute(input) >>> init = F.Depend(init, output) >>> flag = self.get_status(init) # Ensure get_status after your compute >>> self.clear_status(init) >>> print(init) [0. 0. 0. 0. 0. 0. 0. 0.]