mirror of https://github.com/llvm/torch-mlir
26 lines
824 B
Python
26 lines
824 B
Python
# -*- Python -*-
|
|
# This file is licensed under a pytorch-style license
|
|
# See frontends/pytorch/LICENSE for license information.
|
|
|
|
import torch
|
|
import torch_mlir
|
|
|
|
# RUN: %PYTHON %s | npcomp-opt | FileCheck %s
|
|
|
|
mb = torch_mlir.ModuleBuilder()
|
|
|
|
# CHECK-LABEL: func @__torch__.f(
|
|
# CHECK-SAME: %[[T0:.*]]: !numpy.ndarray<*:!numpy.any_dtype>,
|
|
# CHECK-SAME: %[[T1:.*]]: !numpy.ndarray<*:!numpy.any_dtype>) -> !basicpy.TupleType {
|
|
# CHECK: %[[RET:.*]] = basicpy.build_tuple %[[T0]], %[[T1]] : (!numpy.ndarray<*:!numpy.any_dtype>, !numpy.ndarray<*:!numpy.any_dtype>) -> !basicpy.TupleType
|
|
# CHECK: return %[[RET]] : !basicpy.TupleType
|
|
|
|
@mb.import_function
|
|
@torch.jit.script
|
|
def f(t0, t1):
|
|
return t0, t1
|
|
|
|
assert isinstance(f, torch.jit.ScriptFunction)
|
|
mb.module.operation.print()
|
|
print()
|