diff --git a/mindspore/python/mindspore/ops/function/nn_func.py b/mindspore/python/mindspore/ops/function/nn_func.py index 3c8b32b2a48..a52a0b860bb 100644 --- a/mindspore/python/mindspore/ops/function/nn_func.py +++ b/mindspore/python/mindspore/ops/function/nn_func.py @@ -827,7 +827,8 @@ def interpolate(x, roi=None, scales=None, sizes=None, coordinate_transformation_ resize_bilinear_inner = _get_cache_prim(IMG.ResizeBilinearV2)(align_corners, half_pixel_centers) return resize_bilinear_inner(x, output_size) - raise ValueError("Input Error: For interpolate, {} mode is not support now".format(mode)) + raise TypeError( + "Input Error: For interpolate, {} mode is not support now".format(mode)) def softsign(x): @@ -1688,8 +1689,8 @@ def mish(x): >>> input_x = Tensor(np.array([[-1.0, 4.0, -8.0], [2.0, -5.0, 9.0]]), mindspore.float32) >>> output = ops.mish(input_x) >>> print(output) - [[-0.3034014 3.9974129 -0.00026832] - [ 1.9439590 -0.0033576 9.0000000]] + [[-3.0340147e-01 3.9974129e+00 -2.68311895e-03] + [ 1.9439590e+00 -3.3576239e-02 8.99999990e+00]] """ return mish_(x) @@ -1818,7 +1819,7 @@ def grid_sample(input_x, grid, interpolation_mode='bilinear', padding_mode='zero Examples: >>> input_x = Tensor(np.arange(16).reshape((2, 2, 2, 2)).astype(np.float32)) >>> grid = Tensor(np.arange(0.2, 1, 0.1).reshape((2, 2, 1, 2)).astype(np.float32)) - >>> output = ops.grid_sample(input_x, grid, interpolation_mode='bilinear', padding_mode='zeros', + >>> output = grid_sample(input_x, grid, interpolation_mode='bilinear', padding_mode='zeros', align_corners=True) >>> print(output) [[[[ 1.9 ] @@ -1942,8 +1943,7 @@ def ctc_greedy_decoder(inputs, sequence_length, merge_repeated=True): >>> inputs = Tensor(np.array([[[0.6, 0.4, 0.2], [0.8, 0.6, 0.3]], ... [[0.0, 0.6, 0.0], [0.5, 0.4, 0.5]]]), mindspore.float32) >>> sequence_length = Tensor(np.array([2, 2]), mindspore.int32) - >>> decoded_indices, decoded_values, decoded_shape, log_probability = ops.ctc_greedy_decoder(inputs, - sequence_length) + >>> decoded_indices, decoded_values, decoded_shape, log_probability = ctc_greedy_decode(inputs, sequence_length) >>> print(decoded_indices) [[0 0] [0 1] diff --git a/tests/st/ops/gpu/test_matrix_determinant_op.py b/tests/st/ops/gpu/test_matrix_determinant_op.py index 0c763b5993d..5112fffefd6 100644 --- a/tests/st/ops/gpu/test_matrix_determinant_op.py +++ b/tests/st/ops/gpu/test_matrix_determinant_op.py @@ -141,6 +141,8 @@ def test_matrix_determinant_dy_shape(): input_shape = (4, 4) data_type = np.float32 ms_data_type = ms_type.float32 + if data_type in (np.float32, np.complex64): + loss = 1e-3 input_x_np = np.random.random(input_shape).astype(data_type) benchmark_output = matrix_determinant_scipy_benchmark(input_x_np) @@ -169,6 +171,8 @@ def test_log_matrix_determinant_dy_shape(): input_shape = (4, 4) data_type = np.float32 ms_data_type = ms_type.float32 + if data_type in (np.float32, np.complex64): + loss = 1e-3 input_x_np = np.random.random(input_shape).astype(data_type) benchmark_output = log_matrix_determinant_np_benchmark(input_x_np) @@ -195,6 +199,8 @@ def test_matrix_determinant_vmap(): context.set_context(mode=context.GRAPH_MODE) loss = 1e-6 data_type = np.float32 + if data_type in (np.float32, np.complex64): + loss = 1e-3 # Case : in_axes input_x batch remains 0 input_x = Tensor(np.array([[[[-4.5, -1.5], [7.0, 6.0]], [[2.5, 0.5], [3.0, 9.0]]], [[[-4.5, -1.5], [7.0, 6.0]], [[2.5, 0.5], [3.0, 9.0]]]]).astype(data_type)) @@ -219,6 +225,8 @@ def test_log_matrix_determinant_vmap(): context.set_context(mode=context.GRAPH_MODE) loss = 1e-6 data_type = np.float32 + if data_type in (np.float32, np.complex64): + loss = 1e-3 # Case : in_axes input_x batch remains 0 input_x = Tensor(np.array([[[[-4.5, -1.5], [7.0, 6.0]], [[2.5, 0.5], [3.0, 9.0]]], [[[-4.5, -1.5], [7.0, 6.0]], [[2.5, 0.5], [3.0, 9.0]]]]).astype(data_type))