Skip to content

Commit

Permalink
migrate matrix_exp to opInfo tests (pytorch#55533)
Browse files Browse the repository at this point in the history
Summary: Pull Request resolved: pytorch#55533

Test Plan: Imported from OSS

Reviewed By: mruberry

Differential Revision: D27628966

Pulled By: bdhirsh

fbshipit-source-id: 87dd1858a1ebe22dcca9bd90b8cdca8c3d67d0e9
  • Loading branch information
bdhirsh authored and facebook-github-bot committed Apr 13, 2021
1 parent 99d77c5 commit 75eb026
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions torch/testing/_internal/common_methods_invocations.py
Original file line number Diff line number Diff line change
Expand Up @@ -2142,6 +2142,13 @@ def sample_inputs_masked_select(op_info, device, dtype, requires_grad, **kwargs)

return samples

def sample_inputs_matrix_exp(op_info, device, dtype, requires_grad, **kwargs):
samples = (
SampleInput(make_tensor((S, S), device, dtype, requires_grad=requires_grad)),
SampleInput(make_tensor((S, S, S), device, dtype, requires_grad=requires_grad)),
)

return samples

def sample_inputs_polar(op_info, device, dtype, requires_grad, **kwargs):
def _make_tensor_helper(shape, low=None, high=None):
Expand Down Expand Up @@ -3467,6 +3474,11 @@ def gradcheck_wrapper_triangular_input(op, input, *args, upper=False, **kwargs):
dtypesIfCPU=all_types_and_complex_and(torch.bool, torch.half, torch.bfloat16),
dtypesIfCUDA=all_types_and_complex_and(torch.bool, torch.half, torch.bfloat16),
sample_inputs_func=sample_inputs_masked_select),
OpInfo('matrix_exp',
dtypesIfCPU=floating_and_complex_types_and(torch.bfloat16),
dtypesIfCUDA=floating_and_complex_types_and(torch.float16),
sample_inputs_func=sample_inputs_matrix_exp,
supports_out=False),
OpInfo('max',
op=torch.max,
variant_test_name='binary',
Expand Down Expand Up @@ -4734,8 +4746,6 @@ def method_tests():
('matmul', (S, S, M, M), ((S, S, M, S),), "4d_4d", (True,)),
('matmul', (S, S, M, M), ((M,),), "4d_1d", (True,)),
('matmul', (M,), ((S, S, M, S),), "1d_4d", (True,)),
('matrix_exp', (S, S), NO_ARGS, "single_matrix"),
('matrix_exp', (S, S, S), NO_ARGS, "batch_of_matrices"),
('mvlgamma', torch.empty(S,).uniform_(0.5, 1), [1], "p=1"),
('mvlgamma', torch.empty(S,).uniform_(1, 2), [2], "p=2"),
('mvlgamma', torch.empty(S, S).uniform_(1.5, 3), [3], "p=3"),
Expand Down

0 comments on commit 75eb026

Please sign in to comment.