mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-12-05 02:47:00 +08:00
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:
parent
ab1f21768a
commit
001f536c16
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user