mindspore.ops.same_type_shape
- mindspore.ops.same_type_shape(input_x, input_y)[source]
Checks whether the data type and shape of two tensors are the same.
- Parameters
- Returns
Tensor, the shape of tensor is \((x_1, x_2, ..., x_R)\), if data type and shape of input_x and input_y are the same.
- Raises
TypeError – If the data types of input_x and input_y are not the same.
ValueError – If the shapes of input_x and input_y are not the same.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> input_x = Tensor(np.array([[2, 2], [2, 2]]), mindspore.float32) >>> input_y = Tensor(np.array([[2, 2], [2, 2]]), mindspore.float32) >>> output = ops.same_type_shape(input_x, input_y) >>> print(output) [[2. 2.] [2. 2.]]