Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
89bdbb0
add aten::new_empty function
xiaowuhu Dec 25, 2022
3c92572
Update core.py
xiaowuhu Dec 26, 2022
0850518
Update core.py
xiaowuhu Dec 26, 2022
f0e3d00
Update core.py
xiaowuhu Dec 26, 2022
1496f3a
Update core.py
xiaowuhu Dec 26, 2022
8cce23b
Update core.py
xiaowuhu Dec 26, 2022
a75d3aa
Update core.py
xiaowuhu Dec 26, 2022
169a532
Update ops_correctness_test.py
xiaowuhu Dec 26, 2022
690f7bd
update files
xiaowuhu Dec 26, 2022
38c410c
Update core.py
xiaowuhu Dec 27, 2022
7ca5c2c
remove
xiaowuhu Dec 27, 2022
d9917e1
Update core.py
xiaowuhu Dec 27, 2022
9c00791
Update core.py
xiaowuhu Dec 27, 2022
e0ae716
update
xiaowuhu Dec 27, 2022
524836e
update
xiaowuhu Dec 27, 2022
f491426
Update core.py
xiaowuhu Dec 27, 2022
013ee8e
fix bug
xiaowuhu Dec 28, 2022
080ccd7
Update core.py
xiaowuhu Dec 28, 2022
817db54
Update ops_correctness_test.py
xiaowuhu Dec 28, 2022
00733d8
Update ops_correctness_test.py
xiaowuhu Dec 28, 2022
caa523f
Update ops_correctness_test.py
xiaowuhu Dec 28, 2022
c82e423
fix lint
xiaowuhu Dec 28, 2022
9667365
Update core.py
xiaowuhu Dec 28, 2022
1439404
Merge remote-tracking branch 'upstream/main' into xiaowu/trySome
xiaowuhu Jan 9, 2023
59d6ae1
fix bug
xiaowuhu Jan 9, 2023
40ed73b
fix bug
xiaowuhu Jan 9, 2023
1e747db
Update core.py
xiaowuhu Jan 9, 2023
b2b3b52
testing code, for draft
xiaowuhu Jan 9, 2023
d750f4b
Update core.py
xiaowuhu Jan 10, 2023
a8ddb2b
Merge branch 'main' into xiaowu/trySome
xiaowuhu Jan 10, 2023
40d5e0b
Merge remote-tracking branch 'upstream/main' into xiaowu/trySome
xiaowuhu Jan 10, 2023
3eb5f69
Merge remote-tracking branch 'upstream/main' into xiaowu/trySome
xiaowuhu Jan 10, 2023
e0beabd
add ops
xiaowuhu Jan 10, 2023
a205583
Update core.py
xiaowuhu Jan 10, 2023
1e64438
Update core.py
xiaowuhu Jan 10, 2023
3602b8a
Update core.py
xiaowuhu Jan 10, 2023
f833f06
fix bug
xiaowuhu Jan 11, 2023
c507698
Update ops_correctness_test.py
xiaowuhu Jan 11, 2023
48efe33
Merge branch 'main' into xiaowu/trySome
xiaowuhu Jan 11, 2023
e63f9a8
fix lint
xiaowuhu Jan 11, 2023
1018cd1
fix comments
xiaowuhu Jan 11, 2023
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
18 changes: 16 additions & 2 deletions onnxscript/function_libs/torch_aten/ops/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@

from typing import Any, Optional, Sequence

import numpy as np # type: ignore

from onnx import TensorProto
from onnx.helper import make_tensor

from onnxscript import BOOL, INT64
from onnxscript.function_libs.torch_aten.registration import torch_op
from onnxscript.onnx_opset import opset18 as op
Expand Down Expand Up @@ -3408,10 +3413,19 @@ def aten_negative(self: TensorType) -> TensorType:
raise NotImplementedError()


def aten_new_empty(self: TensorType, size: INT64) -> TensorType:
@torch_op("aten::new_empty")
def aten_new_empty(self, size: INT64, dtype: int = -1) -> TensorType:
"""new_empty.

Note: dtype is an onnx enum. Users should convert torch dtype to onnx dtype
before calling this function.
"""
# new_empty(Tensor self, SymInt[] size, *, ScalarType? dtype=None, Layout? layout=None, Device? device=None, bool? pin_memory=None) -> Tensor

raise NotImplementedError()
vals = np.empty(shape=size).flatten()
empty_tensor = op.Constant(value=make_tensor("new_empty", TensorProto.FLOAT, size, vals))
target_tensor = op.CastLike(empty_tensor, self)
return target_tensor


def aten_new_empty_strided(self: TensorType, size: INT64, stride: INT64) -> TensorType:
Expand Down