I’ve been trying to create
tensor.from_elements operation from python bindings but I can’t get it to work. Here is what I thought should work:
from mlir.dialects import arith, tensor from mlir.ir import Context, Location, IntegerType, RankedTensorType with Context(), Location.unknown(): x_type = IntegerType.get_signless(32) x = arith.ConstantOp(x_type, 42) y_type = RankedTensorType.get((1,), x_type) # I couldn't find a way to use this y = tensor.FromElementsOp(x) # and this does nothing at all # I expected y to be %cst = tensor.from_elements 42 : tensor<1xi32> but print(x) # %c42_i32 = arith.constant 42 : i32 print(y) # %c42_i32 = arith.constant 42 : i32 print(x == y) # True
Not sure what I’m missing. Could you help me out?