mirror of https://github.com/llvm/torch-mlir
parent
31ffb815e4
commit
00fc14a6e1
|
@ -230,6 +230,7 @@ static LogicalResult checkValidityOfCast(Type src, Type dest) {
|
|||
(src.isInteger(32) && dest.isInteger(1)) ||
|
||||
(src.isInteger(32) && dest.isF32()) ||
|
||||
(src.isInteger(8) && dest.isInteger(1)) ||
|
||||
(src.isInteger(1) && dest.isInteger(64)) ||
|
||||
(src.isF32() && dest.isInteger(8)) ||
|
||||
(src.isF32() && dest.isInteger(1))) {
|
||||
return success();
|
||||
|
|
|
@ -939,6 +939,25 @@ func.func @torch.aten.to.dtype(%arg0: !torch.vtensor<[3,5],si64>) -> !torch.vten
|
|||
return %0 : !torch.vtensor<[3,5],i1>
|
||||
}
|
||||
|
||||
// -----
|
||||
// CHECK-LABEL: func.func @torch.aten.to.dtype(
|
||||
// CHECK-SAME: %[[VAL_0:.*]]: !torch.vtensor<[1,128],i1>) -> !torch.vtensor<[1,128],si64> {
|
||||
// CHECK: %[[VAL_1:.*]] = torch_c.to_builtin_tensor %[[VAL_0]] : !torch.vtensor<[1,128],i1> -> tensor<1x128xi1>
|
||||
// CHECK: %[[VAL_2:.*]] = torch.constant.int 4
|
||||
// CHECK: %[[VAL_3:.*]] = torch.constant.none
|
||||
// CHECK: %[[VAL_4:.*]] = torch.constant.bool false
|
||||
// CHECK: %[[VAL_5:.*]] = "tosa.cast"(%[[VAL_1]]) : (tensor<1x128xi1>) -> tensor<1x128xi64>
|
||||
// CHECK: %[[VAL_6:.*]] = torch_c.from_builtin_tensor %[[VAL_5]] : tensor<1x128xi64> -> !torch.vtensor<[1,128],si64>
|
||||
// CHECK: return %[[VAL_6]] : !torch.vtensor<[1,128],si64>
|
||||
// CHECK: }
|
||||
func.func @torch.aten.to.dtype(%arg0: !torch.vtensor<[1,128],i1>) -> !torch.vtensor<[1,128],si64> {
|
||||
%int4 = torch.constant.int 4
|
||||
%none = torch.constant.none
|
||||
%false = torch.constant.bool false
|
||||
%0 = torch.aten.to.dtype %arg0, %int4, %false, %false, %none : !torch.vtensor<[1,128],i1>, !torch.int, !torch.bool, !torch.bool, !torch.none -> !torch.vtensor<[1,128],si64>
|
||||
return %0 : !torch.vtensor<[1,128],si64>
|
||||
}
|
||||
|
||||
// -----
|
||||
// CHECK-LABEL: func.func @torch.aten.gather(
|
||||
// CHECK-SAME: %[[VAL_0:.*]]: !torch.vtensor<[1,4,3],f32>,
|
||||
|
|
Loading…
Reference in New Issue