Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request i1 type support in Interpreter #2487

Open
qingyunqu opened this issue Aug 10, 2024 · 1 comment
Open

Request i1 type support in Interpreter #2487

qingyunqu opened this issue Aug 10, 2024 · 1 comment
Assignees

Comments

@qingyunqu
Copy link
Contributor

Request description

It failed when I run some case like:

module {
  func.func @forward(%arg0: tensor<4xf32>) -> tensor<4xi1> {
    %0 = stablehlo.convert %arg0 : (tensor<4xf32>) -> tensor<4xi1>
    return %0 : tensor<4xi1>
  }
}
@sdasgup3
Copy link
Member

sdasgup3 commented Aug 12, 2024

Can you please elaborate on the error message?

Actually, the i1 type is supported in the interpreter. For example,

$ cat test.mlir
module {
  func.func @forward() -> tensor<4xi1> {
     %cst = stablehlo.constant dense<3.0> : tensor<4xf32>
    %0 = stablehlo.convert %cst : (tensor<4xf32>) -> tensor<4xi1>
    return %0 : tensor<4xi1>
  }
}
$ stablehlo-translate --interpret test.mlir
tensor<4xi1> {
  [true, true, true, true]
}

Note: I have modified the above program to specify some input to convert op.

If I run the above mentioned program as is we will get something like (from cs)

error: incorrect number of arguments specified, provided 0 inputs but function expected 1

which means that we have not provided constant inputs equal to the number of program arguments.
Please refer to

auto results = evalModule(*module, {inputValue1, inputValue2}, config);
and
actual = np.array(stablehlo.eval_module(m, args)[0])
on how to use the interpreter programatcally using c+ and python APIs resp.

Please let me know if this helps.

@sdasgup3 sdasgup3 self-assigned this Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants