mindspore.ops.CheckBprop

class mindspore.ops.CheckBprop(prim_to_check='')[源代码]

Checks whether the data type and the shape of corresponding elements from tuples x and y are the same.

Parameters

prim_to_check (str) – The name of the primitive being checked. Default: ‘’.

Inputs:
  • input_x (tuple[Tensor]) - The input_x contains the outputs of bprop to be checked.

  • input_y (tuple[Tensor]) - The input_y contains the inputs of bprop to check against.

Outputs:

Tuple[Tensor], the input_x, if data type and shape of corresponding elements from input_x and input_y are the same.

Raises

TypeError – If input_x or input_y is not a Tensor.

Supported Platforms:

Ascend GPU CPU

Examples

>>> class Net(nn.Cell):
...     def __init__(self):
...         super(Net, self).__init__()
...         self.op = ops.CheckBprop()
...     def construct(self, x, y):
...         return self.op(x, y)
...
>>> net = Net()
>>> input_x = (Tensor(np.array([[2, 2], [2, 2]]), mindspore.float32),)
>>> input_y = (Tensor(np.array([[2, 2], [2, 2]]), mindspore.float32),)
>>> output = net(input_x, input_y)
>>> print(output)
(Tensor(shape=[2, 2], dtype=Float32, value=
[[ 2.00000000e+00,  2.00000000e+00],
 [ 2.00000000e+00,  2.00000000e+00]]),)