8000 update test files by youkaichao · Pull Request #88 · thuml/depyf · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,39 @@
import torch
from torch import device
class GraphModule(torch.nn.Module):
def forward(self, primals_1: "f32[10]", tangents_1: "f32[10]"):
def forward(self, primals_1: "f32[10]", primals_2: "f32[10]", sum_1: "f32[]", tangents_1: "f32[10]"):
# File: /Users/youkaichao/data/DeepLearning/depyf/tests/test_pytorch/test_pytorch.py:4 in toy_function, code: x = a / (torch.abs(a) + 1)
neg: "f32[10]" = torch.ops.aten.neg.default(tangents_1)
abs_1: "f32[10]" = torch.ops.aten.abs.default(primals_1)
add: "f32[10]" = torch.ops.aten.add.Tensor(abs_1, 1); abs_1 = None
div_1: "f32[10]" = torch.ops.aten.div.Tensor(primals_1, add)
div_2: "f32[10]" = torch.ops.aten.div.Tensor(div_1, add); div_1 = None
mul: "f32[10]" = torch.ops.aten.mul.Tensor(neg, div_2); neg = div_2 = None
div_3: "f32[10]" = torch.ops.aten.div.Tensor(tangents_1, add); tangents_1 = add = None
div: "f32[10]" = torch.ops.aten.div.Tensor(primals_1, add)

# File: /Users/youkaichao/data/DeepLearning/depyf/tests/test_pytorch/test_pytorch.py:6 in toy_function, code: return x * b
mul_2: "f32[10]" = torch.ops.aten.mul.Tensor(tangents_1, div)

# File: /Users/youkaichao/data/DeepLearning/depyf/tests/test_pytorch/test_pytorch.py:5 in toy_function, code: b = b * -1 + b.sum()
mul: "f32[10]" = torch.ops.aten.mul.Tensor(primals_2, -1); primals_2 = None
add_1: "f32[10]" = torch.ops.aten.add.Tensor(mul, sum_1); mul = sum_1 = None

# File: /Users/youkaichao/data/DeepLearning/depyf/tests/test_pytorch/test_pytorch.py:6 in toy_function, code: return x * b
mul_3: "f32[10]" = torch.ops.aten.mul.Tensor(tangents_1, add_1); tangents_1 = add_1 = None

# File: /Users/youkaichao/data/DeepLearning/depyf/tests/test_pytorch/test_pytorch.py:5 in toy_function, code: b = b * -1 + b.sum()
sum_2: "f32[]" = torch.ops.aten.sum.default(mul_2)
expand: "f32[10]" = torch.ops.aten.expand.default(sum_2, [10]); sum_2 = None
mul_4: "f32[10]" = torch.ops.aten.mul.Tensor(mul_2, -1); mul_2 = None

# File: /Users/youkaichao/data/DeepLearning/depyf/tests/test_pytorch/test_pytorch.py:5 in toy_function, code: b = b * -1 + b.sum()
add_2: "f32[10]" = torch.ops.aten.add.Tensor(expand, mul_4); expand = mul_4 = None

# File: /Users/youkaichao/data/DeepLearning/depyf/tests/test_pytorch/test_pytorch.py:4 in toy_function, code: x = a / (torch.abs(a) + 1)
neg: "f32[10]" = torch.ops.aten.neg.default(mul_3)
div_2: "f32[10]" = torch.ops.aten.div.Tensor(div, add); div = None
mul_5: "f32[10]" = torch.ops.aten.mul.Tensor(neg, div_2); neg = div_2 = None
div_3: "f32[10]" = torch.ops.aten.div.Tensor(mul_3, add); mul_3 = add = None
sgn: "f32[10]" = torch.ops.aten.sgn.default(primals_1); primals_1 = None
mul_1: "f32[10]" = torch.ops.aten.mul.Tensor(mul, sgn); mul = sgn = None
mul_6: "f32[10]" = torch.ops.aten.mul.Tensor(mul_5, sgn); mul_5 = sgn = None

# File: /Users/youkaichao/data/DeepLearning/depyf/tests/test_pytorch/test_pytorch.py:4 in toy_function, code: x = a / (torch.abs(a) + 1)
add_1: "f32[10]" = torch.ops.aten.add.Tensor(div_3, mul_1); div_3 = mul_1 = None
return (add_1, None)
add_3: "f32[10]" = torch.ops.aten.add.Tensor(div_3, mul_6); div_3 = mul_6 = None
return (add_3, add_2)

Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@ def forward(self, primals_1: "f32[10]", primals_2: "f32[10]"):
add: "f32[10]" = torch.ops.aten.add.Tensor(abs_1, 1); abs_1 = None
div: "f32[10]" = torch.ops.aten.div.Tensor(primals_1, add); add = None

# File: /Users/youkaichao/data/DeepLearning/depyf/tests/test_pytorch/test_pytorch.py:5 in toy_function, code: if b.sum() < 0:
sum_1: "f32[]" = torch.ops.aten.sum.default(primals_2); primals_2 = None
lt: "b8[]" = torch.ops.aten.lt.Scalar(sum_1, 0); sum_1 = None
return (lt, div, primals_1)
# File: /Users/youkaichao/data/DeepLearning/depyf/tests/test_pytorch/test_pytorch.py:5 in toy_function, code: b = b * -1 + b.sum()
mul: "f32[10]" = torch.ops.aten.mul.Tensor(primals_2, -1)
sum_1: "f32[]" = torch.ops.aten.sum.default(primals_2)
add_1: "f32[10]" = torch.ops.aten.add.Tensor(mul, sum_1); mul = None

# File: /Users/youkaichao/data/DeepLearning/depyf/tests/test_pytorch/test_pytorch.py:6 in toy_function, code: return x * b
mul_1: "f32[10]" = torch.ops.aten.mul.Tensor(div, add_1); div = add_1 = None
return (mul_1, primals_1, primals_2, sum_1)

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations
import torch
from torch import device
class joint_helper(torch.nn.Module):
class inner_f(torch.nn.Module):
def forward(self, primals, tangents):
primals_1: "f32[10]"; primals_2: "f32[10]"; tangents_1: "f32[10]";

Expand All @@ -11,20 +11,34 @@ def forward(self, primals, tangents):
add: "f32[10]" = torch.ops.aten.add.Tensor(abs_1, 1); abs_1 = None
div: "f32[10]" = torch.ops.aten.div.Tensor(primals_1, add)

# File: /Users/youkaichao/data/DeepLearning/depyf/tests/test_pytorch/test_pytorch.py:5 in toy_function, code: if b.sum() < 0:
# File: /Users/youkaichao/data/DeepLearning/depyf/tests/test_pytorch/test_pytorch.py:5 in toy_function, code: b = b * -1 + b.sum()
mul: "f32[10]" = torch.ops.aten.mul.Tensor(primals_2, -1)
sum_1: "f32[]" = torch.ops.aten.sum.default(primals_2); primals_2 = None
lt: "b8[]" = torch.ops.aten.lt.Scalar(sum_1, 0); sum_1 = None
add_1: "f32[10]" = torch.ops.aten.add.Tensor(mul, sum_1); mul = sum_1 = None

# File: /Users/youkaichao/data/DeepLearning/depyf/tests/test_pytorch/test_pytorch.py:6 in toy_function, code: return x * b
mul_1: "f32[10]" = torch.ops.aten.mul.Tensor(div, add_1)
mul_2: "f32[10]" = torch.ops.aten.mul.Tensor(tangents_1, div); div = None
mul_3: "f32[10]" = torch.ops.aten.mul.Tensor(tangents_1, add_1); tangents_1 = add_1 = None

# File: /Users/youkaichao/data/DeepLearning/depyf/tests/test_pytorch/test_pytorch.py:5 in toy_function, code: b = b * -1 + b.sum()
sum_2: "f32[]" = torch.ops.aten.sum.default(mul_2)
expand: "f32[10]" = torch.ops.aten.expand.default(sum_2, [10]); sum_2 = None
mul_4: "f32[10]" = torch.ops.aten.mul.Tensor(mul_2, -1); mul_2 = None

# File: /Users/youkaichao/data/DeepLearning/depyf/tests/test_pytorch/test_pytorch.py:5 in toy_function, code: b = b * -1 + b.sum()
add_2: "f32[10]" = torch.ops.aten.add.Tensor(expand, mul_4); expand = mul_4 = None

# File: /Users/youkaichao/data/DeepLearning/depyf/tests/test_pytorch/test_pytorch.py:4 in toy_function, code: x = a / (torch.abs(a) + 1)
neg: "f32[10]" = torch.ops.aten.neg.default(tangents_1)
neg: "f32[10]" = torch.ops.aten.neg.default(mul_3)
div_1: "f32[10]" = torch.ops.aten.div.Tensor(primals_1, add)
div_2: "f32[10]" = torch.ops.aten.div.Tensor(div_1, add); div_1 = None
mul: "f32[10]" = torch.ops.aten.mul.Tensor(neg, div_2); neg = div_2 = None
div_3: "f32[10]" = torch.ops.aten.div.Tensor(tangents_1, add); tangents_1 = add = None
mul_5: "f32[10]" = torch.ops.aten.mul.Tensor(neg, div_2); neg = div_2 = None
div_3: "f32[10]" = torch.ops.aten.div.Tensor(mul_3, add); mul_3 = add = None
sgn: "f32[10]" = torch.ops.aten.sgn.default(primals_1); primals_1 = None
mul_1: "f32[10]" = torch.ops.aten.mul.Tensor(mul, sgn); mul = sgn = None
mul_6: "f32[10]" = torch.ops.aten.mul.Tensor(mul_5, sgn); mul_5 = sgn = None

# File: /Users/youkaichao/data/DeepLearning/depyf/tests/test_pytorch/test_pytorch.py:4 in toy_function, code: x = a / (torch.abs(a) + 1)
add_1: "f32[10]" = torch.ops.aten.add.Tensor(div_3, mul_1); div_3 = mul_1 = None
return pytree.tree_unflatten([lt, div, add_1, None], self._out_spec)
add_3: "f32[10]" = torch.ops.aten.add.Tensor(div_3, mul_6); div_3 = mul_6 = None
return pytree.tree_unflatten([mul_1, add_3, add_2], self._out_spec)

Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ def forward(self, L_a_: "f32[10]", L_b_: "f32[10]"):
add: "f32[10]" = abs_1 + 1; abs_1 = None
x: "f32[10]" = l_a_ / add; l_a_ = add = None

# File: /Users/youkaichao/data/DeepLearning/depyf/tests/test_pytorch/test_pytorch.py:5 in toy_function, code: if b.sum() < 0:
# File: /Users/youkaichao/data/DeepLearning/depyf/tests/test_pytorch/test_pytorch.py:5 in toy_function, code: b = b * -1 + b.sum()
mul: "f32[10]" = l_b_ * -1
sum_1: "f32[]" = l_b_.sum(); l_b_ = None
lt: "b8[]" = sum_1 < 0; sum_1 = None
return (lt, x)
b: "f32[10]" = mul + sum_1; mul = sum_1 = None

# File: /Users/youkaichao/data/DeepLearning/depyf/tests/test_pytorch/test_pytorch.py:6 in toy_function, code: return x * b
mul_1: "f32[10]" = x * b; x = b = None
return (mul_1,)

Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ def forward(self, L_a_: "f32[10]", L_b_: "f32[10]"):
add: "f32[10]" = abs_1 + 1; abs_1 = None
x: "f32[10]" = l_a_ / add; l_a_ = add = None

# File: /Users/youkaichao/data/DeepLearning/depyf/tests/test_pytorch/test_pytorch.py:5 in toy_function, code: if b.sum() < 0:
# File: /Users/youkaichao/data/DeepLearning/depyf/tests/test_pytorch/test_pytorch.py:5 in toy_function, code: b = b * -1 + b.sum()
mul: "f32[10]" = l_b_ * -1
sum_1: "f32[]" = l_b_.sum(); l_b_ = None
lt: "b8[]" = sum_1 < 0; sum_1 = None
return (lt, x)
b: "f32[10]" = mul + sum_1; mul = sum_1 = None

# File: /Users/youkaichao/data/DeepLearning/depyf/tests/test_pytorch/test_pytorch.py:6 in toy_function, code: return x * b
mul_1: "f32[10]" = x * b; x = b = None
return (mul_1,)

Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ def forward(self, L_a_: "f32[10]", L_b_: "f32[10]"):
add: "f32[10]" = abs_1 + 1; abs_1 = None
x: "f32[10]" = l_a_ / add; l_a_ = add = None

# File: /Users/youkaichao/data/DeepLearning/depyf/tests/test_pytorch/test_pytorch.py:5 in toy_function, code: if b.sum() < 0:
# File: /Users/youkaichao/data/DeepLearning/depyf/tests/test_pytorch/test_pytorch.py:5 in toy_function, code: b = b * -1 + b.sum()
mul: "f32[10]" = l_b_ * -1
sum_1: "f32[]" = l_b_.sum(); l_b_ = None
lt: "b8[]" = sum_1 < 0; sum_1 = None
return (lt, x)
b: "f32[10]" = mul + sum_1; mul = sum_1 = None

# File: /Users/youkaichao/data/DeepLearning/depyf/tests/test_pytorch/test_pytorch.py:6 in toy_function, code: return x * b
mul_1: "f32[10]" = x * b; x = b = None
return (mul_1,)

Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ def forward(self, L_a_: "f32[10]", L_b_: "f32[10]"):
add: "f32[10]" = abs_1 + 1; abs_1 = None
x: "f32[10]" = l_a_ / add; l_a_ = add = None

# File: /Users/youkaichao/data/DeepLearning/depyf/tests/test_pytorch/test_pytorch.py:5 in toy_function, code: if b.sum() < 0:
# File: /Users/youkaichao/data/DeepLearning/depyf/tests/test_pytorch/test_pytorch.py:5 in toy_function, code: b = b * -1 + b.sum()
mul: "f32[10]" = l_b_ * -1
sum_1: "f32[]" = l_b_.sum(); l_b_ = None
lt: "b8[]" = sum_1 < 0; sum_1 = None
return (lt, x)
b: "f32[10]" = mul + sum_1; mul = sum_1 = None

# File: /Users/youkaichao/data/DeepLearning/depyf/tests/test_pytorch/test_pytorch.py:6 in toy_function, code: return x * b
mul_1: "f32[10]" = x * b; x = b = None
return (mul_1,)

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from __future__ import annotations
import torch
from torch import device
class GraphModule(torch.nn.Module):
def forward(self, L_a_: "f32[10]", L_b_: "f32[10]"):
l_a_ = L_a_
l_b_ = L_b_

# File: /Users/youkaichao/data/DeepLearning/depyf/tests/test_pytorch/test_pytorch.py:4 in toy_function, code: x = a / (torch.abs(a) + 1)
abs_1: "f32[10]" = torch.abs(l_a_)
add: "f32[10]" = abs_1 + 1; abs_1 = None
x: "f32[10]" = l_a_ / add; l_a_ = add = None

# File: /Users/youkaichao/data/DeepLearning/depyf/tests/test_pytorch/test_pytorch.py:5 in toy_function, code: b = b * -1 + b.sum()
mul: "f32[10]" = l_b_ * -1
sum_1: "f32[]" = l_b_.sum(); l_b_ = None
b: "f32[10]" = mul + sum_1; mul = sum_1 = None

# File: /Users/youkaichao/data/DeepLearning/depyf/tests/test_pytorch/test_pytorch.py:6 in toy_function, code: return x * b
mul_1: "f32[10]" = x * b; x = b = None
return (mul_1,)

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from __future__ import annotations
import torch
from torch import device
class GraphModule(torch.nn.Module):
def forward(self, L_a_: "f32[10]", L_b_: "f32[10]"):
l_a_ = L_a_
l_b_ = L_b_

# File: /Users/youkaichao/data/DeepLearning/depyf/tests/test_pytorch/test_pytorch.py:4 in toy_function, code: x = a / (torch.abs(a) + 1)
abs_1: "f32[10]" = torch.abs(l_a_)
add: "f32[10]" = abs_1 + 1; abs_1 = None
x: "f32[10]" = l_a_ / add; l_a_ = add = None

# File: /Users/youkaichao/data/DeepLearning/depyf/tests/test_pytorch/test_pytorch.py:5 in toy_function, code: b = b * -1 + b.sum()
mul: "f32[10]" = l_b_ * -1
sum_1: "f32[]" = l_b_.sum(); l_b_ = None
b: "f32[10]" = mul + sum_1; mul = sum_1 = None

# File: /Users/youkaichao/data/DeepLearning/depyf/tests/test_pytorch/test_pytorch.py:6 in toy_function, code: return x * b
mul_1: "f32[10]" = x * b; x = b = None
return (mul_1,)

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations
import torch
from torch import device
class joint_helper(torch.nn.Module):
class inner_f(torch.nn.Module):
def forward(self, primals, tangents):
primals_1: "f32[10]"; primals_2: "f32[10]"; tangents_1: "f32[10]";

Expand All @@ -11,20 +11,34 @@ def forward(self, primals, tangents):
add: "f32[10]" = torch.ops.aten.add.Tensor(abs_1, 1); abs_1 = None
div: "f32[10]" = torch.ops.aten.div.Tensor(primals_1, add)

# File: /Users/youkaichao/data/DeepLearning/depyf/tests/test_pytorch/test_pytorch.py:5 in toy_function, code: if b.sum() < 0:
# File: /Users/youkaichao/data/DeepLearning/depyf/tests/test_pytorch/test_pytorch.py:5 in toy_function, code: b = b * -1 + b.sum()
mul: "f32[10]" = torch.ops.aten.mul.Tensor(primals_2, -1)
sum_1: "f32[]" = torch.ops.aten.sum.default(primals_2); primals_2 = None
lt: "b8[]" = torch.ops.aten.lt.Scalar(sum_1, 0); sum_1 = None
add_1: "f32[10]" = torch.ops.aten.add.Tensor(mul, sum_1); mul = sum_1 = None

# File: /Users/youkaichao/data/DeepLearning/depyf/tests/test_pytorch/test_pytorch.py:6 in toy_function, code: return x * b
mul_1: "f32[10]" = torch.ops.aten.mul.Tensor(div, add_1)
mul_2: "f32[10]" = torch.ops.aten.mul.Tensor(tangents_1, div); div = None
mul_3: "f32[10]" = torch.ops.aten.mul.Tensor(tangents_1, add_1); tangents_1 = add_1 = None

# File: /Users/youkaichao/data/DeepLearning/depyf/tests/test_pytorch/test_pytorch.py:5 in toy_function, code: b = b * -1 + b.sum()
sum_2: "f32[]" = torch.ops.aten.sum.default(mul_2)
expand: "f32[10]" = torch.ops.aten.expand.default(sum_2, [10]); sum_2 = None
mul_4: "f32[10]" = torch.ops.aten.mul.Tensor(mul_2, -1); mul_2 = None

# File: /Users/youkaichao/data/DeepLearning/depyf/tests/test_pytorch/test_pytorch.py:5 in toy_function, code: b = b * -1 + b.sum()
add_2: "f32[10]" = torch.ops.aten.add.Tensor(expand, mul_4); expand = mul_4 = None

# File: /Users/youkaichao/data/DeepLearning/depyf/tests/test_pytorch/test_pytorch.py:4 in toy_function, code: x = a / (torch.abs(a) + 1)
neg: "f32[10]" = torch.ops.aten.neg.default(tangents_1)
neg: "f32[10]" = torch.ops.aten.neg.default(mul_3)
div_1: "f32[10]" = torch.ops.aten.div.Tensor(primals_1, add)
div_2: "f32[10]" = torch.ops.aten.div.Tensor(div_1, add); div_1 = None
mul: "f32[10]" = torch.ops.aten.mul.Tensor(neg, div_2); neg = div_2 = None
div_3: "f32[10]" = torch.ops.aten.div.Tensor(tangents_1, add); tangents_1 = add = None
mul_5: "f32[10]" = torch.ops.aten.mul.Tensor(neg, div_2); neg = div_2 = None
div_3: "f32[10]" = torch.ops.aten.div.Tensor(mul_3, add); mul_3 = add = None
sgn: "f32[10]" = torch.ops.aten.sgn.default(primals_1); primals_1 = None
mul_1: "f32[10]" = torch.ops.aten.mul.Tensor(mul, sgn); mul = sgn = None
mul_6: "f32[10]" = torch.ops.aten.mul.Tensor(mul_5, sgn); mul_5 = sgn = None

# File: /Users/youkaichao/data/DeepLearning/depyf/tests/test_pytorch/test_pytorch.py:4 in toy_function, code: x = a / (torch.abs(a) + 1)
add_1: "f32[10]" = torch.ops.aten.add.Tensor(div_3, mul_1); div_3 = mul_1 = None
return pytree.tree_unflatten([lt, div, add_1, None], self._out_spec)
add_3: "f32[10]" = torch.ops.aten.add.Tensor(div_3, mul_6); div_3 = mul_6 = None
return pytree.tree_unflatten([mul_1, add_3, add_2], self._out_spec)

This file was deleted.

This file was deleted.

Loading
0