Skip to content

Commit

Permalink
rename _offsets to _staticShapeOffsets
Browse files Browse the repository at this point in the history
  • Loading branch information
ZlobinGM committed Dec 15, 2020
1 parent accd51e commit e8563e4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class Allocator final {

DataMap<allocator::MemChunk*> _memChunksPerData;

std::map<std::pair<DimVector, DimValues>, int> _offsets;
std::map<std::pair<DimVector, DimValues>, int> _staticShapeOffsets;

int _blobMemOffset = 0;
int _inputMemOffset = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,16 +317,16 @@ ShapeLocation Allocator::allocateShape(const Data& data) {
// Static allocation
shapeLocation.dimsLocation = Location::Blob;

// Prevert allocation of same shapes multiple times
// Prevent allocation of same shapes multiple times
auto dimOrder = data->desc().dimsOrder().toPermutation();
auto dimValues = data->desc().dims();
auto itr = _offsets.find({dimOrder, dimValues});
if (itr != _offsets.end()) {
auto itr = _staticShapeOffsets.find({dimOrder, dimValues});
if (itr != _staticShapeOffsets.end()) {
shapeLocation.dimsOffset = itr->second;
} else {
shapeLocation.dimsOffset = _blobMemOffset;
_blobMemOffset += dimsByteSize;
_offsets.insert({{dimOrder, dimValues}, shapeLocation.dimsOffset});
_staticShapeOffsets.insert({{dimOrder, dimValues}, shapeLocation.dimsOffset});
}
}

Expand Down

0 comments on commit e8563e4

Please sign in to comment.