Skip to content

Commit

Permalink
Fix transposed shape calculation for static model where the transposed
Browse files Browse the repository at this point in the history
order is less then canonicalized shape
  • Loading branch information
yeonbok committed May 1, 2024
1 parent 179fde6 commit 41cc201
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/plugins/intel_gpu/src/graph/impls/ocl/gemm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,20 @@ struct gemm_impl : multi_stage_primitive<gemm> {
(primitive->input_rank == primitive->weight_rank);
if (is_broadcastable) {
auto transpose_pshape = [](const ov::PartialShape pshape, const std::vector<int64_t>& order) {
auto transposed_pshape = ov::PartialShape::dynamic(pshape.rank());
for (size_t i = 0; i < order.size(); i++) {
transposed_pshape[i] = pshape[order[i]];
if (order.size() < pshape.size()) {
auto transposed_pshape = pshape;
auto rank_diff = pshape.size() - order.size();
for (size_t i = 0; i < order.size(); i++){
transposed_pshape[i + rank_diff] = pshape[rank_diff + order[i]];
}
return transposed_pshape;
} else {
auto transposed_pshape = ov::PartialShape::dynamic(pshape.rank());
for (size_t i = 0; i < order.size(); i++) {
transposed_pshape[i] = pshape[order[i]];
}
return transposed_pshape;
}
return transposed_pshape;
};
size_t max_rank = input0_pshape.size();
auto default_order = ov::intel_gpu::op::Gemm::default_order(max_rank);
Expand Down

0 comments on commit 41cc201

Please sign in to comment.