Skip to content
Open
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
28 changes: 2 additions & 26 deletions paconvert/api_mapping.json
Original file line number Diff line number Diff line change
Expand Up @@ -5910,19 +5910,7 @@
"Matcher": "ChangePrefixMatcher"
},
"torch.gcd": {
"Matcher": "GenericMatcher",
"paddle_api": "paddle.gcd",
"min_input_args": 2,
"args_list": [
"input",
"other",
"*",
"out"
],
"kwargs_change": {
"input": "x",
"other": "y"
}
"Matcher": "ChangePrefixMatcher"
},
"torch.ge": {
"Matcher": "ChangePrefixMatcher"
Expand Down Expand Up @@ -6458,19 +6446,7 @@
"Matcher": "ChangePrefixMatcher"
},
"torch.lcm": {
"Matcher": "GenericMatcher",
"paddle_api": "paddle.lcm",
"min_input_args": 2,
"args_list": [
"input",
"other",
"*",
"out"
],
"kwargs_change": {
"input": "x",
"other": "y"
}
"Matcher": "ChangePrefixMatcher"
},
"torch.ldexp": {
"Matcher": "GenericMatcher",
Expand Down
17 changes: 14 additions & 3 deletions tests/test_Tensor_t.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,31 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

import textwrap

from apibase import APIBase

obj = APIBase("torch.Tensor.t")
obj = APIBase("torch.Tensor.T")


def test_case_1():
pytorch_code = textwrap.dedent(
"""
import torch
a = torch.Tensor([[1.,2.], [3.,4.]])
result = a.t()
x = torch.arange(16).reshape(4, 4)
result = x.T
"""
)
obj.run(pytorch_code, ["result"])


def test_case_2():
pytorch_code = textwrap.dedent(
"""
import torch
result = torch.arange(16).reshape(4, 4).T
"""
)
obj.run(pytorch_code, ["result"])
Loading