Skip to content

Commit

Permalink
Fixed "Invalid F spec" error while building FullyConnected layer.
Browse files Browse the repository at this point in the history
`int depth = strtol(*str + 1, str, 10);`
`**str` holds the words in the VGSL specification, and `*str` holds a single word, lets say, `Fr64`. Now, the `strtol` function modifies `str` to point to the first character which a non-digit number, and assumes that ` *str+1 ` points to a number (of valid integer format) as a string (automatically skipping all the white spaces, and no other characters), where in reality, it seems to point to `r` in `Fr164`.This is a bad argument, which results in strtol returning 0.
` strtol (*str + 2, str, 10)` should be passed instead.
  • Loading branch information
srdg authored Jul 6, 2018
1 parent ab1f217 commit 001f536
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lstm/networkbuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ Network* NetworkBuilder::ParseFullyConnected(const StaticShape& input_shape,
tprintf("Invalid nonlinearity on F-spec!: %s\n", *str);
return nullptr;
}
int depth = strtol(*str + 1, str, 10);
int depth = strtol(*str + 2, str, 10);
if (depth <= 0) {
tprintf("Invalid F spec!:%s\n", *str);
return nullptr;
Expand Down

0 comments on commit 001f536

Please sign in to comment.