We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
normalize_to_dim_index
1 parent 83d92ff commit 8b63ea8Copy full SHA for 8b63ea8
backends/vulkan/runtime/graph/ops/impl/utils/DimUtils.h
@@ -32,7 +32,8 @@ constexpr DimIndex kChannel4D = DimIndex::DIM_3RD_LAST;
32
constexpr DimIndex kBatch4D = DimIndex::DIM_4TH_LAST;
33
34
inline DimIndex normalize_to_dim_index(const api::vTensor& v_in, int32_t dim) {
35
- return static_cast<DimIndex>(dim - v_in.dim());
+ return dim < 0 ? static_cast<DimIndex>(dim)
36
+ : static_cast<DimIndex>(dim - v_in.dim());
37
}
38
39
/*
0 commit comments