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
83ecf1d9
Commit
83ecf1d9
authored
Dec 06, 2015
by
Davis King
Browse files
Made alias_tensor serializable.
parent
ad40ddd3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
0 deletions
+30
-0
dlib/dnn/tensor.h
dlib/dnn/tensor.h
+24
-0
dlib/dnn/tensor_abstract.h
dlib/dnn/tensor_abstract.h
+6
-0
No files found.
dlib/dnn/tensor.h
View file @
83ecf1d9
...
@@ -521,6 +521,30 @@ namespace dlib
...
@@ -521,6 +521,30 @@ namespace dlib
alias_tensor_instance
inst
;
alias_tensor_instance
inst
;
};
};
inline
void
serialize
(
const
alias_tensor
&
item
,
std
::
ostream
&
out
)
{
int
version
=
1
;
serialize
(
version
,
out
);
serialize
(
item
.
num_samples
(),
out
);
serialize
(
item
.
k
(),
out
);
serialize
(
item
.
nr
(),
out
);
serialize
(
item
.
nc
(),
out
);
}
inline
void
deserialize
(
alias_tensor
&
item
,
std
::
istream
&
in
)
{
int
version
=
0
;
deserialize
(
version
,
in
);
if
(
version
!=
1
)
throw
serialization_error
(
"Unexpected version found while deserializing dlib::alias_tensor."
);
long
num_samples
,
k
,
nr
,
nc
;
deserialize
(
num_samples
,
in
);
deserialize
(
k
,
in
);
deserialize
(
nr
,
in
);
deserialize
(
nc
,
in
);
item
=
alias_tensor
(
num_samples
,
k
,
nr
,
nc
);
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
}
}
...
...
dlib/dnn/tensor_abstract.h
View file @
83ecf1d9
...
@@ -527,6 +527,12 @@ namespace dlib
...
@@ -527,6 +527,12 @@ namespace dlib
!*/
!*/
};
};
void
serialize
(
const
alias_tensor
&
item
,
std
::
ostream
&
out
)
void
deserialize
(
alias_tensor
&
item
,
std
::
istream
&
in
);
/*!
provides serialization support for alias_tensor.
!*/
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
}
}
...
...
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