Skip to content

Commit

Permalink
GENERIC_2D_ARRAY: Pass parameters by reference
Browse files Browse the repository at this point in the history
This fixes warnings from LGTM:

This parameter of type FontClassInfo is 192 bytes
- consider passing a pointer/reference instead.

Signed-off-by: Stefan Weil <[email protected]>
  • Loading branch information
stweil committed Oct 6, 2018
1 parent a798218 commit 238c872
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ccstruct/matrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ class GENERIC_2D_ARRAY {
}

// Accumulates the element-wise sums of squares of src into *this.
void SumSquares(const GENERIC_2D_ARRAY<T>& src, T decay_factor) {
void SumSquares(const GENERIC_2D_ARRAY<T>& src, const T& decay_factor) {
T update_factor = 1.0 - decay_factor;
int size = num_elements();
for (int i = 0; i < size; ++i) {
Expand All @@ -377,7 +377,7 @@ class GENERIC_2D_ARRAY {
// Scales each element using the adam algorithm, ie array_[i] by
// sqrt(sqsum[i] + epsilon)).
void AdamUpdate(const GENERIC_2D_ARRAY<T>& sum,
const GENERIC_2D_ARRAY<T>& sqsum, T epsilon) {
const GENERIC_2D_ARRAY<T>& sqsum, const T& epsilon) {
int size = num_elements();
for (int i = 0; i < size; ++i) {
array_[i] += sum.array_[i] / (sqrt(sqsum.array_[i]) + epsilon);
Expand Down

0 comments on commit 238c872

Please sign in to comment.