Skip to content

Commit

Permalink
fix meshgrid (#23)
Browse files Browse the repository at this point in the history
* fix meshgrid

* fix normal_ p
  • Loading branch information
z379035389 authored May 9, 2023
1 parent b702b11 commit b3e6ac3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion DIOPI-TEST/python/conformance/conformance_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def test_normal_(input, mean, std, shape=None):
out_numpy = out.numpy()
out_numpy = out_numpy.flatten()
p_value = stats.kstest(out_numpy, 'norm', args=(mean, std))[1]
assert p_value > 0.05, "failed to execute normal_"
assert p_value > 0.0005, "failed to execute normal_"

def test_multinomial(input, num_samples, replacement):
out = F.multinomial(input, num_samples, replacement)
Expand Down
11 changes: 8 additions & 3 deletions DIOPI-TEST/python/conformance/diopi_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4448,9 +4448,13 @@
tensor_para=dict(
args=[
{
"ins": ['tensor'],
"shape": ((8,), (16,), (32,)),
"dtype": [Dtype.float32, Dtype.float64, Dtype.int64],
"ins": ['tensors'],
"shape": (((8,), (8,), (8,)),
((16,), (8,), ()),
((32,), (16,)), ((8,),)),
"dtype": [Dtype.float16, Dtype.float32, Dtype.float64,
Dtype.int16, Dtype.int32, Dtype.int64,
Dtype.int8, Dtype.uint8, Dtype.bool],
"gen_fn": Genfunc.randn,
"gen_num_range": [1, 5],
},
Expand All @@ -4459,6 +4463,7 @@
),
),


'multinomial': dict(
name=["multinomial"],
interface=['torch'],
Expand Down
7 changes: 4 additions & 3 deletions DIOPI-TEST/python/conformance/diopi_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3585,10 +3585,11 @@ def meshgrid(tensors, shape=None):
co_tensors = []
dims = []
for tensor in tensors:
assert (len(tensor.size()) == 1),\
"Expected scalar or 1D tensor in the tensor list"
c_tensors.append(tensor.tensor_handle)
dims.append(tensor.size()[0])
if len(tensor.size()) > 0:
dims.append(tensor.size()[0])
else:
dims.append(1)
c_tensors = (c_void_p * inputsNum)(*c_tensors)
out = [Tensor(dims, tensors[0].get_dtype()) for i in range(inputsNum)]
for tensor in out:
Expand Down

0 comments on commit b3e6ac3

Please sign in to comment.