diff --git a/main/_images/RReLU.png b/main/_images/RReLU.png index f949e7dfce..ead5d91c89 100644 Binary files a/main/_images/RReLU.png and b/main/_images/RReLU.png differ diff --git a/main/_modules/index.html b/main/_modules/index.html index e99ef1585a..647749d227 100644 --- a/main/_modules/index.html +++ b/main/_modules/index.html @@ -280,7 +280,7 @@

Result:

@@ -864,7 +879,7 @@

cond_branch_nested_function

Note

-

Tags: torch.cond, torch.dynamic-shape

+

Tags: torch.dynamic-shape, torch.cond

Support Level: SUPPORTED

Original source code:

@@ -921,12 +936,15 @@

cond_branch_nonlocal_variables[x, my_tensor_var, torch.tensor(my_primitive_var)], ) -example_inputs = (torch.randn(6),) +example_args = (torch.randn(6),) tags = { "torch.cond", "torch.dynamic-shape", } model = CondBranchNonlocalVariables() + + +torch.export.export(model, example_args)

Result:

@@ -991,9 +1009,12 @@

cond_closed_over_variablereturn cond(pred, true_fn, false_fn, [x + 1]) -example_inputs = (torch.tensor(True), torch.randn(3, 2)) +example_args = (torch.tensor(True), torch.randn(3, 2)) tags = {"torch.cond", "python.closure"} model = CondClosedOverVariable() + + +torch.export.export(model, example_args)

Result:

@@ -1026,7 +1047,7 @@

cond_closed_over_variable

Note

-

Tags: torch.cond, torch.dynamic-shape

+

Tags: torch.dynamic-shape, torch.cond

Support Level: SUPPORTED

Original source code:

@@ -1058,7 +1079,7 @@

cond_operandsreturn cond(x.shape[0] > 2, true_fn, false_fn, [x, y]) -example_inputs = (x, y) +example_args = (x, y) tags = { "torch.cond", "torch.dynamic-shape", @@ -1066,6 +1087,9 @@

cond_operandsextra_inputs = (torch.randn(2, 2), torch.randn(2)) dynamic_shapes = {"x": {0: dim0_x}, "y": None} model = CondOperands() + + +torch.export.export(model, example_args, dynamic_shapes=dynamic_shapes)

Result:

@@ -1100,7 +1124,7 @@

cond_operands

Note

-

Tags: torch.cond, torch.dynamic-shape

+

Tags: torch.dynamic-shape, torch.cond

Support Level: SUPPORTED

Original source code:

@@ -1123,12 +1147,15 @@

cond_predicatereturn cond(pred, lambda x: x.cos(), lambda y: y.sin(), [x]) -example_inputs = (torch.randn(6, 4, 3),) +example_args = (torch.randn(6, 4, 3),) tags = { "torch.cond", "torch.dynamic-shape", } model = CondPredicate() + + +torch.export.export(model, example_args)

Result:

@@ -1161,7 +1188,7 @@

cond_predicate

Note

-

Tags: torch.escape-hatch, torch.dynamic-value

+

Tags: torch.dynamic-value, torch.escape-hatch

Support Level: SUPPORTED

Original source code:

@@ -1184,12 +1211,15 @@

constrain_as_size_examplereturn torch.zeros((a, 5)) -example_inputs = (torch.tensor(4),) +example_args = (torch.tensor(4),) tags = { "torch.dynamic-value", "torch.escape-hatch", } model = ConstrainAsSizeExample() + + +torch.export.export(model, example_args)

Result:

@@ -1222,7 +1252,7 @@

constrain_as_size_example

Note

-

Tags: torch.escape-hatch, torch.dynamic-value

+

Tags: torch.dynamic-value, torch.escape-hatch

Support Level: SUPPORTED

Original source code:

@@ -1248,12 +1278,15 @@

constrain_as_value_examplereturn y.cos() -example_inputs = (torch.tensor(4), torch.randn(5, 5)) +example_args = (torch.tensor(4), torch.randn(5, 5)) tags = { "torch.dynamic-value", "torch.escape-hatch", } model = ConstrainAsValueExample() + + +torch.export.export(model, example_args)

Result:

@@ -1308,8 +1341,11 @@

decoratordef forward(self, x, y): return x + y -example_inputs = (torch.randn(3, 2), torch.randn(3, 2)) +example_args = (torch.randn(3, 2), torch.randn(3, 2)) model = Decorator() + + +torch.export.export(model, example_args)

Result:

@@ -1350,9 +1386,12 @@

dictionaryy = y * elements["x2"] return {"y": y} -example_inputs = (torch.randn(3, 2), torch.tensor(4)) +example_args = (torch.randn(3, 2), torch.tensor(4)) tags = {"python.data-structure"} model = Dictionary() + + +torch.export.export(model, example_args)

Result:

@@ -1394,9 +1433,12 @@

dynamic_shape_assertassert x.shape[0] > 1 return x -example_inputs = (torch.randn(3, 2),) +example_args = (torch.randn(3, 2),) tags = {"python.assert"} model = DynamicShapeAssert() + + +torch.export.export(model, example_args)

Result:

@@ -1430,9 +1472,12 @@

dynamic_shape_constructordef forward(self, x): return torch.zeros(x.shape[0] * 2) -example_inputs = (torch.randn(3, 2),) +example_args = (torch.randn(3, 2),) tags = {"torch.dynamic-shape"} model = DynamicShapeConstructor() + + +torch.export.export(model, example_args)

Result:

@@ -1472,9 +1517,12 @@

dynamic_shape_if_guardreturn x.sin() -example_inputs = (torch.randn(3, 2, 2),) +example_args = (torch.randn(3, 2, 2),) tags = {"torch.dynamic-shape", "python.control-flow"} model = DynamicShapeIfGuard() + + +torch.export.export(model, example_args)

Result:

@@ -1494,7 +1542,7 @@

dynamic_shape_if_guarddynamic_shape_map

Note

-

Tags: torch.map, torch.dynamic-shape

+

Tags: torch.dynamic-shape, torch.map

Support Level: SUPPORTED

Original source code:

@@ -1514,9 +1562,12 @@

dynamic_shape_mapreturn map(body, xs, y) -example_inputs = (torch.randn(3, 2), torch.randn(2)) +example_args = (torch.randn(3, 2), torch.randn(2)) tags = {"torch.dynamic-shape", "torch.map"} model = DynamicShapeMap() + + +torch.export.export(model, example_args)

Result:

@@ -1559,9 +1610,12 @@

dynamic_shape_slicingdef forward(self, x): return x[: x.shape[0] - 2, x.shape[1] - 1 :: 2] -example_inputs = (torch.randn(3, 2),) +example_args = (torch.randn(3, 2),) tags = {"torch.dynamic-shape"} model = DynamicShapeSlicing() + + +torch.export.export(model, example_args)

Result:

@@ -1600,9 +1654,12 @@

dynamic_shape_viewx = x.view(*new_x_shape) return x.permute(0, 2, 1) -example_inputs = (torch.randn(10, 10),) +example_args = (torch.randn(10, 10),) tags = {"torch.dynamic-shape"} model = DynamicShapeView() + + +torch.export.export(model, example_args)

Result:

@@ -1632,8 +1689,6 @@

fn_with_kwargs

Result:

ExportedProgram:
     class GraphModule(torch.nn.Module):
         def forward(self, pos0: "f32[4]", tuple0_0: "f32[4]", tuple0_1: "f32[4]", myargs_0: "f32[4]", myargs_1: "f32[4]", mykw0: "f32[4]", input0: "f32[4]", input1: "f32[4]"):
-             # File: /opt/conda/envs/py_3.8/lib/python3.8/site-packages/torch/_export/db/examples/fn_with_kwargs.py:14 in forward, code: out = out * arg
+             # File: /opt/conda/envs/py_3.8/lib/python3.8/site-packages/torch/_export/db/examples/fn_with_kwargs.py:12 in forward, code: out = out * arg
             mul: "f32[4]" = torch.ops.aten.mul.Tensor(pos0, tuple0_0);  pos0 = tuple0_0 = None
             mul_1: "f32[4]" = torch.ops.aten.mul.Tensor(mul, tuple0_1);  mul = tuple0_1 = None
 
-             # File: /opt/conda/envs/py_3.8/lib/python3.8/site-packages/torch/_export/db/examples/fn_with_kwargs.py:16 in forward, code: out = out * arg
+             # File: /opt/conda/envs/py_3.8/lib/python3.8/site-packages/torch/_export/db/examples/fn_with_kwargs.py:14 in forward, code: out = out * arg
             mul_2: "f32[4]" = torch.ops.aten.mul.Tensor(mul_1, myargs_0);  mul_1 = myargs_0 = None
             mul_3: "f32[4]" = torch.ops.aten.mul.Tensor(mul_2, myargs_1);  mul_2 = myargs_1 = None
 
-             # File: /opt/conda/envs/py_3.8/lib/python3.8/site-packages/torch/_export/db/examples/fn_with_kwargs.py:17 in forward, code: out = out * mykw0
+             # File: /opt/conda/envs/py_3.8/lib/python3.8/site-packages/torch/_export/db/examples/fn_with_kwargs.py:15 in forward, code: out = out * mykw0
             mul_4: "f32[4]" = torch.ops.aten.mul.Tensor(mul_3, mykw0);  mul_3 = mykw0 = None
 
-             # File: /opt/conda/envs/py_3.8/lib/python3.8/site-packages/torch/_export/db/examples/fn_with_kwargs.py:18 in forward, code: out = out * mykwargs["input0"] * mykwargs["input1"]
+             # File: /opt/conda/envs/py_3.8/lib/python3.8/site-packages/torch/_export/db/examples/fn_with_kwargs.py:16 in forward, code: out = out * mykwargs["input0"] * mykwargs["input1"]
             mul_5: "f32[4]" = torch.ops.aten.mul.Tensor(mul_4, input0);  mul_4 = input0 = None
             mul_6: "f32[4]" = torch.ops.aten.mul.Tensor(mul_5, input1);  mul_5 = input1 = None
             return (mul_6,)
@@ -1689,7 +1750,7 @@ 

fn_with_kwargs

Original source code:

@@ -1707,9 +1768,12 @@

list_containsassert "monkey" not in ["cow", "pig"] return x + x -example_inputs = (torch.randn(3, 2),) +example_args = (torch.randn(3, 2),) tags = {"torch.dynamic-shape", "python.data-structure", "python.assert"} model = ListContains() + + +torch.export.export(model, example_args)

Result:

@@ -1752,9 +1816,12 @@

list_unpackx, *y = args return x + y[0] -example_inputs = ([torch.randn(3, 2), torch.tensor(4), torch.tensor(5)],) +example_args = ([torch.randn(3, 2), torch.tensor(4), torch.tensor(5)],) tags = {"python.control-flow", "python.data-structure"} model = ListUnpack() + + +torch.export.export(model, example_args)

Result:

@@ -1798,9 +1865,12 @@

nested_functionreturn closure(x) -example_inputs = (torch.randn(3, 2), torch.randn(2)) +example_args = (torch.randn(3, 2), torch.randn(2)) tags = {"python.closure"} model = NestedFunction() + + +torch.export.export(model, example_args)

Result:

@@ -1852,9 +1922,12 @@

null_context_managerwith ctx: return x.sin() + x.cos() -example_inputs = (torch.randn(3, 2),) +example_args = (torch.randn(3, 2),) tags = {"python.context-manager"} model = NullContextManager() + + +torch.export.export(model, example_args)

Result:

@@ -1894,8 +1967,11 @@

pytree_flatteny, spec = pytree.tree_flatten(x) return y[0] + 1 -example_inputs = ({1: torch.randn(3, 2), 2: torch.randn(3, 2)},), +example_args = ({1: torch.randn(3, 2), 2: torch.randn(3, 2)},), model = PytreeFlatten() + + +torch.export.export(model, example_args)

Result:

@@ -1938,10 +2014,13 @@

scalar_outputdef forward(self, x): return x.shape[1] + 1 -example_inputs = (x,) +example_args = (x,) tags = {"torch.dynamic-shape"} dynamic_shapes = {"x": {1: dim1_x}} model = ScalarOutput() + + +torch.export.export(model, example_args, dynamic_shapes=dynamic_shapes)

Result:

@@ -1990,8 +2069,11 @@

specialized_attributeelse: raise ValueError("bad") -example_inputs = (torch.randn(3, 2),) +example_args = (torch.randn(3, 2),) model = SpecializedAttribute() + + +torch.export.export(model, example_args)

Result:

@@ -2030,9 +2112,12 @@

static_for_loopret.append(i + x) return ret -example_inputs = (torch.randn(3, 2),) +example_args = (torch.randn(3, 2),) tags = {"python.control-flow"} model = StaticForLoop() + + +torch.export.export(model, example_args)

Result:

@@ -2080,9 +2165,12 @@

static_ifreturn x -example_inputs = (torch.randn(3, 2, 2),) +example_args = (torch.randn(3, 2, 2),) tags = {"python.control-flow"} model = StaticIf() + + +torch.export.export(model, example_args)

Result:

@@ -2119,9 +2207,12 @@

tensor_setattrsetattr(x, attr, torch.randn(3, 2)) return x + 4 -example_inputs = (torch.randn(3, 2), "attr") +example_args = (torch.randn(3, 2), "attr") tags = {"python.builtin"} model = TensorSetattr() + + +torch.export.export(model, example_args)

Result:

@@ -2164,9 +2255,12 @@

type_reflection_methodreturn type(a).func(x) -example_inputs = (torch.randn(3, 4),) +example_args = (torch.randn(3, 4),) tags = {"python.builtin"} model = TypeReflectionMethod() + + +torch.export.export(model, example_args)

Result:

@@ -2204,9 +2298,12 @@

user_input_mutationreturn x.cos() -example_inputs = (torch.randn(3, 2),) +example_args = (torch.randn(3, 2),) tags = {"torch.mutation"} model = UserInputMutation() + + +torch.export.export(model, example_args)

Result:

@@ -2232,7 +2329,7 @@

Not Supported Yet

Note

-

Tags: torch.dynamic-shape, python.builtin

+

Tags: python.builtin, torch.dynamic-shape

Support Level: NOT_SUPPORTED_YET

Original source code:

@@ -2252,11 +2349,14 @@

dynamic_shape_roundx = torch.randn(3, 2) dim0_x = Dim("dim0_x") -example_inputs = (x,) +example_args = (x,) tags = {"torch.dynamic-shape", "python.builtin"} support_level = SupportLevel.NOT_SUPPORTED_YET dynamic_shapes = {"x": {0: dim0_x}} model = DynamicShapeRound() + + +torch.export.export(model, example_args, dynamic_shapes=dynamic_shapes)

Result:

@@ -2295,10 +2395,13 @@

model_attr_mutationreturn x.sum() + self.attr_list[0].sum() -example_inputs = (torch.randn(3, 2),) +example_args = (torch.randn(3, 2),) tags = {"python.object-model"} support_level = SupportLevel.NOT_SUPPORTED_YET model = ModelAttrMutation() + + +torch.export.export(model, example_args)

Result:

@@ -2331,10 +2434,13 @@

optional_inputreturn x -example_inputs = (torch.randn(2, 3),) +example_args = (torch.randn(2, 3),) tags = {"python.object-model"} support_level = SupportLevel.NOT_SUPPORTED_YET model = OptionalInput() + + +torch.export.export(model, example_args)

Result:

@@ -2365,14 +2471,17 @@

torch_sym_minreturn x.sum() + torch.sym_min(x.size(0), 100) -example_inputs = (torch.randn(3, 2),) +example_args = (torch.randn(3, 2),) tags = {"torch.operator"} support_level = SupportLevel.NOT_SUPPORTED_YET model = TorchSymMin() + + +torch.export.export(model, example_args)

Result:

-

Result:

@@ -572,7 +575,7 @@

dynamic_shape_assertlist_contains

Original source code:

@@ -590,9 +593,12 @@

list_containsassert "monkey" not in ["cow", "pig"] return x + x -example_inputs = (torch.randn(3, 2),) +example_args = (torch.randn(3, 2),) tags = {"torch.dynamic-shape", "python.data-structure", "python.assert"} model = ListContains() + + +torch.export.export(model, example_args)

Result:

diff --git a/main/generated/exportdb/python.builtin.html b/main/generated/exportdb/python.builtin.html index 929a59e83e..ebcbe4defc 100644 --- a/main/generated/exportdb/python.builtin.html +++ b/main/generated/exportdb/python.builtin.html @@ -281,7 +281,7 @@

Result:

@@ -585,9 +588,12 @@

tensor_setattrsetattr(x, attr, torch.randn(3, 2)) return x + 4 -example_inputs = (torch.randn(3, 2), "attr") +example_args = (torch.randn(3, 2), "attr") tags = {"python.builtin"} model = TensorSetattr() + + +torch.export.export(model, example_args)

Result:

@@ -630,9 +636,12 @@

type_reflection_methodreturn type(a).func(x) -example_inputs = (torch.randn(3, 4),) +example_args = (torch.randn(3, 4),) tags = {"python.builtin"} model = TypeReflectionMethod() + + +torch.export.export(model, example_args)

Result:

diff --git a/main/generated/exportdb/python.closure.html b/main/generated/exportdb/python.closure.html index db42f1a5ce..967633f277 100644 --- a/main/generated/exportdb/python.closure.html +++ b/main/generated/exportdb/python.closure.html @@ -41,7 +41,7 @@ - +