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

[torchlib] Improve aten::fill #1754

Merged
merged 2 commits into from
Jul 25, 2024
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions onnxscript/function_libs/torch_lib/ops/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -3622,10 +3622,6 @@ def aten_full(

if dtype != -1:
fill_value = op.Cast(fill_value, to=dtype)
if isinstance(size, list) and size == []:
# TODO(justinchuby): Handle empty list better than using isinstance
# size can be empty, meaning a scalar
return fill_value

size = op.Cast(size, to=INT64.dtype)
return op.Expand(fill_value, size)
Expand Down
2 changes: 1 addition & 1 deletion onnxscript/tools/benchmark/benchmark_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ def common_export(
if exporter == "script":
torch.onnx.export(
model,
inputs,
inputs, # type: ignore[arg-type]
filename,
do_constant_folding=False,
input_names=[f"input{i}" for i in range(len(inputs))],
Expand Down
1 change: 1 addition & 0 deletions onnxscript/tools/transformers_models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
prog = torch.onnx.export(model, args, dynamo=True) # pylint: disable=no-value-for-parameter
else:
prog = torch.onnx.dynamo_export(model, *args)
assert prog is not None

Check warning on line 44 in onnxscript/tools/transformers_models/__init__.py

View check run for this annotation

Codecov / codecov/patch

onnxscript/tools/transformers_models/__init__.py#L44

Added line #L44 was not covered by tests
model_proto = prog.model_proto
if optimize:
model_proto = onnxscript.optimizer.optimize(
Expand Down
Loading