Skip to content

Conversation

@rickzx
Copy link
Contributor

@rickzx rickzx commented May 8, 2024

For workloads with a mixture of symbolic shape and concrete shape as batch sizes, we cannot directly use int() to obtain the batch size. Instead, we can use arith.Analyzer to check equality.

For example:

permute_dims1: R.Tensor((batch_size, 12, seq_len, 64), dtype="float16") = R.permute_dims(split_0, axes=[0, 2, 1, 3])
permute_dims2: R.Tensor((batch_size, 12, seq_len, 64), dtype="float16") = R.permute_dims(split_1, axes=[0, 2, 1, 3])
permute_dims3: R.Tensor((batch_size, 12, seq_len, 64), dtype="float16") = R.permute_dims(split_2, axes=[0, 2, 1, 3])
permute_dims4: R.Tensor((batch_size, 12, 64, seq_len), dtype="float16") = R.permute_dims(permute_dims2, axes=[0, 1, 3, 2])
matmul1: R.Tensor((batch_size, 12, seq_len, seq_len), dtype="float16") = R.matmul(permute_dims1, permute_dims4, out_dtype="float16")

@rickzx
Copy link
Contributor Author

rickzx commented May 8, 2024

cc: @MasterJH5574

Copy link
Contributor

@MasterJH5574 MasterJH5574 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants