2022-03-10 08:44:22 +08:00
|
|
|
// RUN: torch-mlir-opt -torch-drop-shape-calculations -split-input-file %s | FileCheck %s
|
|
|
|
|
2022-05-17 03:54:35 +08:00
|
|
|
// CHECK-LABEL: func.func @basic(
|
2022-03-10 08:44:22 +08:00
|
|
|
// CHECK-SAME: %[[ARG:.*]]: !torch.vtensor<[2,?],unk>) -> !torch.vtensor {
|
|
|
|
// CHECK: %[[TANH:.*]] = torch.aten.tanh %[[ARG]] : !torch.vtensor<[2,?],unk> -> !torch.vtensor<[2,?],unk>
|
|
|
|
// CHECK: %[[ERASED:.*]] = torch.tensor_static_info_cast %[[TANH]] : !torch.vtensor<[2,?],unk> to !torch.vtensor
|
|
|
|
// CHECK: return %[[ERASED]] : !torch.vtensor
|
2022-05-17 03:54:35 +08:00
|
|
|
func.func @basic(%arg0: !torch.vtensor<[2,?],unk>) -> !torch.vtensor {
|
2022-03-10 08:44:22 +08:00
|
|
|
%int2 = torch.constant.int 2
|
|
|
|
%int1 = torch.constant.int 1
|
|
|
|
%0 = torch.shape.calculate {
|
|
|
|
%2 = torch.aten.tanh %arg0 : !torch.vtensor<[2,?],unk> -> !torch.vtensor<[2,?],unk>
|
|
|
|
torch.shape.calculate.yield %2 : !torch.vtensor<[2,?],unk>
|
|
|
|
} shapes {
|
|
|
|
%2 = torch.aten.size.int %arg0, %int1 : !torch.vtensor<[2,?],unk>, !torch.int -> !torch.int
|
2022-03-16 07:22:56 +08:00
|
|
|
%3 = torch.prim.ListConstruct %int2, %2 : (!torch.int, !torch.int) -> !torch.list<int>
|
|
|
|
torch.shape.calculate.yield.shapes %3 : !torch.list<int>
|
2022-03-10 08:44:22 +08:00
|
|
|
} : !torch.vtensor<[2,?],unk>
|
|
|
|
%1 = torch.tensor_static_info_cast %0 : !torch.vtensor<[2,?],unk> to !torch.vtensor
|
|
|
|
return %1 : !torch.vtensor
|
|
|
|
}
|