mirror of https://github.com/llvm/torch-mlir
30 lines
946 B
Python
30 lines
946 B
Python
|
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||
|
# See https://llvm.org/LICENSE.txt for license information.
|
||
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||
|
# Also available under a BSD-style license. See LICENSE.
|
||
|
|
||
|
import torch
|
||
|
|
||
|
from torch_mlir_e2e_test.torchscript.framework import TestUtils
|
||
|
from torch_mlir_e2e_test.torchscript.registry import register_test_case
|
||
|
from torch_mlir_e2e_test.torchscript.annotations import annotate_args, export
|
||
|
|
||
|
|
||
|
class AddIntModule(torch.nn.Module):
|
||
|
def __init__(self):
|
||
|
super().__init__()
|
||
|
|
||
|
@export
|
||
|
@annotate_args([
|
||
|
None,
|
||
|
([], torch.int64, True),
|
||
|
([], torch.int64, True),
|
||
|
])
|
||
|
def forward(self, lhs, rhs):
|
||
|
return int(lhs)+int(rhs)
|
||
|
|
||
|
|
||
|
@register_test_case(module_factory=lambda: AddIntModule())
|
||
|
def AddIntModule_basic(module, tu: TestUtils):
|
||
|
module.forward(torch.randint(-100, 100,()), torch.randint(-100, 100,()))
|