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
OpenDAS
dlib
Commits
565bed38
Commit
565bed38
authored
Jan 23, 2016
by
Davis King
Browse files
Made it so you can deserialize bn_ objects into affine_ objects.
parent
c7813163
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
dlib/dnn/layers.h
dlib/dnn/layers.h
+12
-0
dlib/dnn/layers_abstract.h
dlib/dnn/layers_abstract.h
+5
-0
No files found.
dlib/dnn/layers.h
View file @
565bed38
...
...
@@ -11,6 +11,7 @@
#include "../rand.h"
#include "../string.h"
#include "tensor_tools.h"
#include "../vectorstream.h"
namespace
dlib
...
...
@@ -884,6 +885,17 @@ namespace dlib
{
std
::
string
version
;
deserialize
(
version
,
in
);
if
(
version
==
"bn_"
)
{
// Since we can build an affine_ from a bn_ we check if that's what is in
// the stream and if so then just convert it right here.
unserialize
sin
(
version
,
in
);
bn_
temp
;
deserialize
(
temp
,
sin
);
item
=
temp
;
return
;
}
if
(
version
!=
"affine_"
)
throw
serialization_error
(
"Unexpected version found while deserializing dlib::affine_."
);
deserialize
(
item
.
params
,
in
);
...
...
dlib/dnn/layers_abstract.h
View file @
565bed38
...
...
@@ -154,6 +154,11 @@ namespace dlib
This kind of pattern is useful if you want to use one type of layer
during training but a different type of layer during testing since it
allows you to easily convert between related deep neural network types.
Additionally, if you provide a constructor to build a layer from another
layer type you should also write your layer's deserialize() routine such
that it can read that other layer's serialized data in addition to your
own serialized data.
!*/
template
<
typename
SUBNET
>
...
...
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