Skip to content
Merged
Changes from 1 commit
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
8 changes: 8 additions & 0 deletions onnxscript/function_libs/torch_lib/ops/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@
_MATH_PI = math.pi


@torch_op("aten::_local_scalar_dense")
def aten__local_scalar_dense(self: TTensor) -> TTensor:
Copy link
Copy Markdown
Collaborator

@justinchuby justinchuby Jul 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a docstring with its aten signature from https://aka.ms/native-functions like other functions do (looks like it's _local_scalar_dense(Tensor self) -> Scalar. Would be nice to have a reference to its implementation or documentation too.


flattened = op.Reshape(self, op.Constant(value_ints=[-1]))
first_item_as_scalar = op.Gather(flattened, 0)
return first_item_as_scalar


@torch_op("aten::abs")
def aten_abs(self: TRealOrUInt8) -> TRealOrUInt8:
"""abs(Tensor self) -> Tensor"""
Expand Down