Skip to content

Commit

Permalink
Adding OpInfo for logical_or, logical_and, logical_xor (#67178)
Browse files Browse the repository at this point in the history
Summary:
This PR addresses #54261.

This adds OpInfos for binary logical element wise operators. This is my first PR in OpInfos to PyTorch, looking forward to suggestions and any feedback.

cc: mruberry krshrimali

Pull Request resolved: #67178

Reviewed By: jbschlosser

Differential Revision: D32057889

Pulled By: mruberry

fbshipit-source-id: 7e670260af6b478dba9d6e8d77de4df1b6d0b5d1
  • Loading branch information
ankitaS11 authored and facebook-github-bot committed Nov 2, 2021
1 parent c65f332 commit cd51d2a
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions torch/testing/_internal/common_methods_invocations.py
Original file line number Diff line number Diff line change
Expand Up @@ -8920,6 +8920,33 @@ def ref_pairwise_distance(input1, input2):
DecorateInfo(unittest.skip("Skipped!"), 'TestBinaryUfuncs', 'test_broadcast_python_scalar'),
),
),
BinaryUfuncInfo('logical_and',
ref=np.logical_and,
dtypes=all_types_and_complex_and(torch.bool, torch.half, torch.bfloat16),
sample_inputs_func=sample_inputs_binary_pwise,
supports_autograd=False,
# FIXME: logical_and does not accept scalar inputs
skips=(
DecorateInfo(unittest.expectedFailure, 'TestBinaryUfuncs', 'test_broadcast_python_scalar'),
)),
BinaryUfuncInfo('logical_or',
ref=np.logical_or,
dtypes=all_types_and_complex_and(torch.bool, torch.half, torch.bfloat16),
sample_inputs_func=sample_inputs_binary_pwise,
supports_autograd=False,
# FIXME: logical_or does not accept scalar inputs
skips=(
DecorateInfo(unittest.expectedFailure, 'TestBinaryUfuncs', 'test_broadcast_python_scalar'),
)),
BinaryUfuncInfo('logical_xor',
ref=np.logical_xor,
dtypes=all_types_and_complex_and(torch.bool, torch.half, torch.bfloat16),
sample_inputs_func=sample_inputs_binary_pwise,
supports_autograd=False,
# FIXME: logical_xor does not accept scalar inputs
skips=(
DecorateInfo(unittest.expectedFailure, 'TestBinaryUfuncs', 'test_broadcast_python_scalar'),
)),
# `softmax` supports different dtypes based on whether `dtype` argument,
# is passed or not. Hence two OpInfo entries, one with dtype and other without.
OpInfo('softmax',
Expand Down

0 comments on commit cd51d2a

Please sign in to comment.