Skip to content

Commit

Permalink
refactor: remove unused field in sparse_iterator (#4259)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackgerrits authored Nov 4, 2022
1 parent c478177 commit 96448d3
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions vowpalwabbit/core/include/vw/core/array_parameters_sparse.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class sparse_iterator
using pointer = T*;
using reference = T&;

sparse_iterator(weight_map::iterator iter, uint64_t stride) : _iter(iter), _stride(stride) {}
sparse_iterator(weight_map::iterator iter) : _iter(iter) {}

sparse_iterator& operator=(const sparse_iterator& other) = default;
sparse_iterator(const sparse_iterator& other) = default;
Expand All @@ -46,7 +46,6 @@ class sparse_iterator

private:
weight_map::iterator _iter;
uint32_t _stride;
};

class sparse_parameters
Expand All @@ -68,12 +67,12 @@ class sparse_parameters
VW::weight* first() { THROW_OR_RETURN("Allreduce currently not supported in sparse", nullptr); }

// iterator with stride
iterator begin() { return iterator(_map.begin(), stride()); }
iterator end() { return iterator(_map.begin(), stride()); }
iterator begin() { return iterator(_map.begin()); }
iterator end() { return iterator(_map.begin()); }

// const iterator
const_iterator cbegin() const { return const_iterator(_map.begin(), stride()); }
const_iterator cend() const { return const_iterator(_map.begin(), stride()); }
const_iterator cbegin() const { return const_iterator(_map.begin()); }
const_iterator cend() const { return const_iterator(_map.begin()); }

inline VW::weight& operator[](size_t i) { return *(get_or_default_and_get(i)); }

Expand Down

0 comments on commit 96448d3

Please sign in to comment.