Dynamic Shapes to MAX GRAPH API

Giving dynamic shape to the graph is giving me error. My code:
fn main() raises:
var x = Tensor[DType.float32] (1,2,5)
var y = Tensor[DType.float32] (1,2,5)


var in_types = List[Type] (TensorType(DType.float32, "a", "b", "c"), TensorType(DType.float32, "a", "b", "c"))
var graph10 = Graph(in_types=in_types)
var inputs = List[Symbol] (graph10[0], graph10[1])
var c = ops.concat(inputs, -1)
graph10.output(c)
graph10.verify()
var session = engine.InferenceSession()
var concat = session.load(graph10)

var results = concat.execute("input0", x, "input1", y)
var xd = results.get[DType.float32] ("output0")

print(x.shape())
print(y.shape())
print(xd.shape())
fn main() raises:
var x = Tensor[DType.float32] (1,2,5)
var y = Tensor[DType.float32] (1,2,5)


var in_types = List[Type] (TensorType(DType.float32, "a", "b", "c"), TensorType(DType.float32, "a", "b", "c"))
var graph10 = Graph(in_types=in_types)
var inputs = List[Symbol] (graph10[0], graph10[1])
var c = ops.concat(inputs, -1)
graph10.output(c)
graph10.verify()
var session = engine.InferenceSession()
var concat = session.load(graph10)

var results = concat.execute("input0", x, "input1", y)
var xd = results.get[DType.float32] ("output0")

print(x.shape())
print(y.shape())
print(xd.shape())
Error:
Unhandled exception caught during execution: Unsupported dim type: symbolic expression
Unhandled exception caught during execution: Unsupported dim type: symbolic expression
But if I do
var in_types = List[Type] (TensorType(DType.float32, 1, 2, 5), TensorType(DType.float32, 1, 2, 5))
var in_types = List[Type] (TensorType(DType.float32, 1, 2, 5), TensorType(DType.float32, 1, 2, 5))
It works fine. And the issue is only with concat function. I've tried giving dynamic shapes with matmul and it's working fine. Can anyone please guide what I'm doing wrong here?
1 Reply
taalhaataahir01022001
Now getting same error issue with Layer norm i.e.,
var graph2 = Graph(in_types=List[Type](TensorType(DType.float32, "a", "b", "c"),TensorType(DType.float32, "c"), TensorType(DType.float32, "c")))
var graph2 = Graph(in_types=List[Type](TensorType(DType.float32, "a", "b", "c"),TensorType(DType.float32, "c"), TensorType(DType.float32, "c")))
gives error Unhandled exception caught during execution: Unsupported dim type: symbolic expression Previously it was working fine!!
Want results from more Discord servers?
Add your server