Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create shared function to handle complex casting | fix(torchlib) #1147

Merged
merged 5 commits into from
Nov 13, 2023

Conversation

justinchuby
Copy link
Collaborator

@justinchuby justinchuby commented Nov 11, 2023

pytorch/pytorch#113444 Exposed an error where when dtype=torch.complex64 in aten_scalar_tensor_sym_number, we produce a node with it output being complex. This change extracts the logic from prims::convert_element_type to a common function to handle complex dtypes.

Adds complex test for scalar_tensor.

@justinchuby justinchuby added the topic: torch_lib Related to the torch/aten function lib in development label Nov 11, 2023
Copy link

codecov bot commented Nov 11, 2023

Codecov Report

Merging #1147 (b856321) into main (ec0fe03) will increase coverage by 0.04%.
The diff coverage is 73.07%.

@@            Coverage Diff             @@
##             main    #1147      +/-   ##
==========================================
+ Coverage   78.46%   78.51%   +0.04%     
==========================================
  Files         118      118              
  Lines       15156    15161       +5     
  Branches     1619     1619              
==========================================
+ Hits        11892    11903      +11     
+ Misses       2888     2881       -7     
- Partials      376      377       +1     
Files Coverage Δ
...ipt/tests/function_libs/torch_lib/ops_test_data.py 96.18% <ø> (ø)
onnxscript/function_libs/torch_lib/ops/core.py 79.91% <83.33%> (ø)
onnxscript/function_libs/torch_lib/ops/prims.py 52.17% <66.66%> (+1.98%) ⬆️
onnxscript/function_libs/torch_lib/ops/common.py 80.00% <70.58%> (-12.31%) ⬇️

Copy link

Test Results

         18 files  ±0         18 suites  ±0   1h 20m 44s ⏱️ - 4m 6s
  11 175 tests ±0    8 385 ✔️ ±0      2 737 💤 ±0       53 ±0 
159 894 runs  ±0  37 064 ✔️ ±0  120 787 💤 ±0  2 043 ±0 

For more details on these failures, see this check.

Results for commit b856321. ± Comparison against base commit ec0fe03.

This pull request removes 163 and adds 163 tests. Note that renamed tests count towards both.
onnxscript.function_libs.tools.torch_lib.deduce_type_constraints_test.TestDeduceTypeConstraints ‑ test_deduce_type_constraints_does_not_crash_for_onnx_function_aten_scalar_tensor
onnxscript.function_libs.tools.torch_lib.deduce_type_constraints_test.TestDeduceTypeConstraints ‑ test_deduce_type_constraints_does_not_crash_for_onnx_function_aten_scalar_tensor_sym_number
onnxscript.tests.function_libs.torch_lib.ops_test.TestFunctionValidity ‑ test_function_has_op_schema_215_aten_scatter_add
onnxscript.tests.function_libs.torch_lib.ops_test.TestFunctionValidity ‑ test_function_has_op_schema_216_aten_select
onnxscript.tests.function_libs.torch_lib.ops_test.TestFunctionValidity ‑ test_function_has_op_schema_217_aten_select_scatter
onnxscript.tests.function_libs.torch_lib.ops_test.TestFunctionValidity ‑ test_function_has_op_schema_218_aten_sigmoid
onnxscript.tests.function_libs.torch_lib.ops_test.TestFunctionValidity ‑ test_function_has_op_schema_219_aten_sign
onnxscript.tests.function_libs.torch_lib.ops_test.TestFunctionValidity ‑ test_function_has_op_schema_220_aten_sin
onnxscript.tests.function_libs.torch_lib.ops_test.TestFunctionValidity ‑ test_function_has_op_schema_221_aten_sinh
onnxscript.tests.function_libs.torch_lib.ops_test.TestFunctionValidity ‑ test_function_has_op_schema_222_aten_softmax
…
onnxscript.tests.function_libs.torch_lib.ops_test.TestFunctionValidity ‑ test_function_has_op_schema_215_aten_scalar_tensor
onnxscript.tests.function_libs.torch_lib.ops_test.TestFunctionValidity ‑ test_function_has_op_schema_216_aten_scatter_add
onnxscript.tests.function_libs.torch_lib.ops_test.TestFunctionValidity ‑ test_function_has_op_schema_217_aten_select
onnxscript.tests.function_libs.torch_lib.ops_test.TestFunctionValidity ‑ test_function_has_op_schema_218_aten_select_scatter
onnxscript.tests.function_libs.torch_lib.ops_test.TestFunctionValidity ‑ test_function_has_op_schema_219_aten_sigmoid
onnxscript.tests.function_libs.torch_lib.ops_test.TestFunctionValidity ‑ test_function_has_op_schema_220_aten_sign
onnxscript.tests.function_libs.torch_lib.ops_test.TestFunctionValidity ‑ test_function_has_op_schema_221_aten_sin
onnxscript.tests.function_libs.torch_lib.ops_test.TestFunctionValidity ‑ test_function_has_op_schema_222_aten_sinh
onnxscript.tests.function_libs.torch_lib.ops_test.TestFunctionValidity ‑ test_function_has_op_schema_223_aten_softmax
onnxscript.tests.function_libs.torch_lib.ops_test.TestFunctionValidity ‑ test_function_has_op_schema_224_aten_split_with_sizes
…

@justinchuby justinchuby merged commit ad6f9e1 into main Nov 13, 2023
27 of 31 checks passed
@justinchuby justinchuby deleted the justinchu/fix-cast-complex branch November 13, 2023 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: torch_lib Related to the torch/aten function lib in development
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants