dense_tensor.mlir 787 字节
Newer Older
1
// RUN: infrtexec -i %s | FileCheck %s
2

3 4
// CHECK-LABEL: @sign_any_float32_execute
func @sign_any_float32_execute() {
5
  %ctx = "phi_dt.create_context.cpu" (): () -> !phi.context<CPU>
W
Wilber 已提交
6
  %t = "phi_dt.create_dense_tensor.cpu" (%ctx) {
7 8
    precision=#infrt.precision<FP32>, 
    layout=#infrt.layout<NCHW>, lod=[1:i64], dims=[1:i64]}: (!phi.context<CPU>) -> (!infrt.dense_tensor<CPU, FP32, NCHW>)
9
  "phi_dt.fill_dense_tensor.f32"(%t) {value=[3.8:f32]} : (!infrt.dense_tensor<CPU, FP32, NCHW>) -> ()
10
  %e = "phi_cpu.sign.float32.any"(%ctx, %t) : (!phi.context<CPU>, !infrt.dense_tensor<CPU, FP32, NCHW>) -> (!infrt.dense_tensor<CPU, FP32, NCHW>)
11

12
  // CHECK: dense_tensor: shape=shape[1], value=[1]
13
  "phi_dt.print_tensor" (%e) : (!infrt.dense_tensor<CPU, FP32, NCHW>) -> ()
14
  infrt.return
15
}
16