!31758 restore testcase bug of broadcastto op

Merge pull request !31758 from wangyanling/master
This commit is contained in:
i-robot 2022-03-24 08:03:23 +00:00 committed by Gitee
commit 4f480138d5
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 2 additions and 2 deletions

View File

@ -141,7 +141,7 @@ bool BroadcastToCpuKernelMod::LaunchKernel(const std::vector<AddressPtr> &inputs
std::vector<KernelAttr> BroadcastToCpuKernelMod::GetOpSupport() {
auto iter = func_list_.find(kernel_type_);
if (iter == func_list_.end()) {
MS_LOG(EXCEPTION) << "Does not support " << kernel_type_ << "!";
MS_LOG(EXCEPTION) << "not support " << kernel_type_ << "!";
}
std::vector<KernelAttr> support_list;

View File

@ -115,5 +115,5 @@ def test_broadcast_dyn_invalid_init():
context.set_context(mode=context.GRAPH_MODE, device_target='CPU')
ms_shape = (2, -1, 4, 5)
x_np = np.random.rand(4, 5).astype(np.float32)
with pytest.raises(ValueError):
with pytest.raises(ValueError) or pytest.raises(RuntimeError):
P.BroadcastTo(ms_shape)(Tensor(x_np))