Skip to content

Commit 6f40601

Browse files
author
Russell Stewart
authored
Merge pull request stanfordnlp#75 from stanfordnlp/Russell91-patch-2
Fixed initialize_parameters indentation to remove tabs.
2 parents f28c449 + 308aca6 commit 6f40601

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/glove.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ int scmp( char *s1, char *s2 ) {
6464
}
6565

6666
void initialize_parameters() {
67-
long long a, b;
68-
vector_size++; // Temporarily increment to allocate space for bias
69-
70-
/* Allocate space for word vectors and context word vectors, and correspodning gradsq */
71-
a = posix_memalign((void **)&W, 128, 2 * vocab_size * (vector_size + 1) * sizeof(real)); // Might perform better than malloc
67+
long long a, b;
68+
vector_size++; // Temporarily increment to allocate space for bias
69+
70+
/* Allocate space for word vectors and context word vectors, and correspodning gradsq */
71+
a = posix_memalign((void **)&W, 128, 2 * vocab_size * (vector_size + 1) * sizeof(real)); // Might perform better than malloc
7272
if (W == NULL) {
7373
fprintf(stderr, "Error allocating memory for W\n");
7474
exit(1);
@@ -78,9 +78,9 @@ void initialize_parameters() {
7878
fprintf(stderr, "Error allocating memory for gradsq\n");
7979
exit(1);
8080
}
81-
for (b = 0; b < vector_size; b++) for (a = 0; a < 2 * vocab_size; a++) W[a * vector_size + b] = (rand() / (real)RAND_MAX - 0.5) / vector_size;
82-
for (b = 0; b < vector_size; b++) for (a = 0; a < 2 * vocab_size; a++) gradsq[a * vector_size + b] = 1.0; // So initial value of eta is equal to initial learning rate
83-
vector_size--;
81+
for (b = 0; b < vector_size; b++) for (a = 0; a < 2 * vocab_size; a++) W[a * vector_size + b] = (rand() / (real)RAND_MAX - 0.5) / vector_size;
82+
for (b = 0; b < vector_size; b++) for (a = 0; a < 2 * vocab_size; a++) gradsq[a * vector_size + b] = 1.0; // So initial value of eta is equal to initial learning rate
83+
vector_size--;
8484
}
8585

8686
inline real check_nan(real update) {

0 commit comments

Comments
 (0)