Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
ResNet50_tensorflow
Commits
044e26d7
Commit
044e26d7
authored
Mar 02, 2017
by
Chris Waterson
Committed by
GitHub
Mar 02, 2017
Browse files
Merge pull request #1090 from vmarkovtsev/master
Fix the infinitite loop in reading files
parents
37d86a95
ab322fd9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
swivel/fastprep.cc
swivel/fastprep.cc
+7
-1
No files found.
swivel/fastprep.cc
View file @
044e26d7
...
...
@@ -79,6 +79,10 @@ Options:
--window_size <int>
Specifies the window size for computing co-occurrence stats;
default 10.
--num_threads <int>
The number of workers to calculate the co-occurrence matrix;
default 4.
)"
;
struct
cooc_t
{
...
...
@@ -448,7 +452,7 @@ void CoocCounter::Count() {
fin_
.
seekg
(
start_
);
int
nlines
=
0
;
for
(
off_t
filepos
=
start_
;
filepos
<
end_
;
filepos
=
fin_
.
tellg
())
{
for
(
off_t
filepos
=
start_
;
filepos
<
end_
&&
!
fin_
.
eof
()
;
filepos
=
fin_
.
tellg
())
{
// Buffer a single sentence.
std
::
vector
<
int
>
sentence
;
bool
eos
;
...
...
@@ -633,6 +637,8 @@ int main(int argc, char *argv[]) {
std
::
vector
<
pthread_t
>
threads
;
std
::
vector
<
CoocCounter
*>
counters
;
const
off_t
nbytes_per_thread
=
input_size
/
num_threads
;
std
::
cout
<<
"Running "
<<
num_threads
<<
" threads, each on "
<<
nbytes_per_thread
<<
" bytes"
<<
std
::
endl
;
pthread_attr_t
attr
;
if
(
pthread_attr_init
(
&
attr
)
!=
0
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment