Fixed "Invalid F spec" error while building FullyConnected layer.

`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.
This commit is contained in:
Soumik Ranjan Dasgupta 2018-07-06 23:54:22 +05:30 committed by GitHub
parent ab1f21768a
commit 001f536c16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -426,7 +426,7 @@ Network* NetworkBuilder::ParseFullyConnected(const StaticShape& input_shape,
tprintf("Invalid nonlinearity on F-spec!: %s\n", *str); tprintf("Invalid nonlinearity on F-spec!: %s\n", *str);
return nullptr; return nullptr;
} }
int depth = strtol(*str + 1, str, 10); int depth = strtol(*str + 2, str, 10);
if (depth <= 0) { if (depth <= 0) {
tprintf("Invalid F spec!:%s\n", *str); tprintf("Invalid F spec!:%s\n", *str);
return nullptr; return nullptr;