I’m trying to define some tensor constants with std.constant but notice mlir-opt just crashes with some very simple cases. I have my test cases listed below for reference. Is constant tensor a supported scenario for std.constant? I probably missed something obvious. Thanks.
//crash at mlir-opt --convert-std-to-llvm std.constant.mlir
func @tensor_constant_0d_f32() -> tensor<f32> {
%cst = std.constant dense<0.0> : tensor<f32>
return %cst : tensor<f32>
}
//crash at mlir-opt --convert-std-to-llvm std.constant.mlir
func @tensor_constant_1d_f32() -> tensor<4xf32> {
%cst = std.constant dense<[1.0, 2.0, 3.0, 4.0]> : tensor<4xf32>
return %cst : tensor<4xf32>
}
// crash at mlir-opt --convert-std-to-llvm std.constant.mlir
func @tensor_constant_2d_f32() -> tensor<3x4xf32> {
%0 = std.constant dense<[[0.0, 0.0, 0.0, 0.0], [1.0, 1.0, 1.0, 1.0], [2.0, 2.0, 2.0, 2.0]]>
: tensor<3x4xf32>
return %0 : tensor<3x4xf32>
}