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

Fixed the issue where autocompare reports input is modified in situations like torch.exp(x, out=x) #72

Merged
merged 1 commit into from
Oct 25, 2024

Conversation

zhaoguochun1995
Copy link
Collaborator

@zhaoguochun1995 zhaoguochun1995 commented Oct 25, 2024

torch.exp(x, out=x) 这种用法下,实际是个inplace 操作。autocompare会对输入做检查,会检查算子算完后输入是否被错误的修改。如果是这种情况下,原先会报输入被修改,同时会保存相关的checkpoint。现在修复了该问题

autocompare    torch.exp forward_id: 1    
/deeplink_afs/zhaoguochun/ditorch2/op_tools/test/test_tool_with_special_op.py:202 test_input_is_output: torch.exp(x, out=x)
+---------------------------+--------+---------+-------+-----------+------------+---------------+---------------+----------------+
|            name           | device |  dtype  | numel |   shape   |   stride   | requires_grad |     layout    |    data_ptr    |
+---------------------------+--------+---------+-------+-----------+------------+---------------+---------------+----------------+
|      torch.exp inputs     | cuda:0 | float32 |   60  | (3, 4, 5) | (20, 5, 1) |     False     | torch.strided | 20067179823104 |
|    torch.exp inputs out   | cuda:0 | float32 |   60  | (3, 4, 5) | (20, 5, 1) |     False     | torch.strided | 20067179823104 |
|     torch.exp outputs     | cuda:0 | float32 |   60  | (3, 4, 5) | (20, 5, 1) |     False     | torch.strided | 20067179823104 |
|   torch.exp inputs(cpu)   |  cpu   | float32 |   60  | (3, 4, 5) | (20, 5, 1) |     False     | torch.strided |   514196288    |
| torch.exp inputs(cpu) out |  cpu   | float32 |   60  | (3, 4, 5) | (20, 5, 1) |     False     | torch.strided |   514196288    |
|   torch.exp outputs(cpu)  |  cpu   | float32 |   60  | (3, 4, 5) | (20, 5, 1) |     False     | torch.strided |   514196288    |
+---------------------------+--------+---------+-------+-----------+------------+---------------+---------------+----------------+
+--------------------------------+----------+-------------------+--------------+-------------------+-------------+-------------+------------+
|              name              | allclose | cosine_similarity | max_abs_diff | max_relative_diff |     atol    |     rtol    | error_info |
+--------------------------------+----------+-------------------+--------------+-------------------+-------------+-------------+------------+
| torch.exp input                |   True   |    0.999999881    | 0.000000477  |    0.000000108    | 0.000010000 | 0.000010000 |            |
| torch.exp output               |   True   |    0.999999881    | 0.000000477  |    0.000000108    | 0.000010000 | 0.000010000 |            |
+--------------------------------+----------+-------------------+--------------+-------------------+-------------+-------------+------------+

@zhaoguochun1995 zhaoguochun1995 changed the title Fixed the issue where autocompare reports input being modified in situations like torch.exp(x, out=x) Fixed the issue where autocompare reports input is modified in situations like torch.exp(x, out=x) Oct 25, 2024
@yangbofun yangbofun merged commit a38822b into main Oct 25, 2024
13 checks passed
@yangbofun yangbofun deleted the zgc/ditorch_fix_autocompare_input_is_output_case branch October 25, 2024 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants