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
4dfeb7e1
Commit
4dfeb7e1
authored
Jan 30, 2017
by
Davis King
Browse files
Made alias_tensor usable when it is const.
parent
7ba8ea9c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
dlib/dnn/tensor.h
dlib/dnn/tensor.h
+3
-3
dlib/dnn/tensor_abstract.h
dlib/dnn/tensor_abstract.h
+2
-2
No files found.
dlib/dnn/tensor.h
View file @
4dfeb7e1
...
@@ -615,7 +615,7 @@ namespace dlib
...
@@ -615,7 +615,7 @@ namespace dlib
alias_tensor_instance
operator
()
(
alias_tensor_instance
operator
()
(
tensor
&
t
,
tensor
&
t
,
size_t
offset
size_t
offset
)
)
const
{
{
DLIB_CASSERT
(
offset
+
size
()
<=
t
.
size
());
DLIB_CASSERT
(
offset
+
size
()
<=
t
.
size
());
...
@@ -637,7 +637,7 @@ namespace dlib
...
@@ -637,7 +637,7 @@ namespace dlib
alias_tensor_const_instance
operator
()
(
alias_tensor_const_instance
operator
()
(
const
tensor
&
t
,
const
tensor
&
t
,
size_t
offset
size_t
offset
)
)
const
{
{
alias_tensor_const_instance
temp
;
alias_tensor_const_instance
temp
;
temp
.
inst
=
(
*
this
)(
const_cast
<
tensor
&>
(
t
),
offset
);
temp
.
inst
=
(
*
this
)(
const_cast
<
tensor
&>
(
t
),
offset
);
...
@@ -645,7 +645,7 @@ namespace dlib
...
@@ -645,7 +645,7 @@ namespace dlib
}
}
private:
private:
alias_tensor_instance
inst
;
mutable
alias_tensor_instance
inst
;
};
};
inline
void
serialize
(
const
alias_tensor
&
item
,
std
::
ostream
&
out
)
inline
void
serialize
(
const
alias_tensor
&
item
,
std
::
ostream
&
out
)
...
...
dlib/dnn/tensor_abstract.h
View file @
4dfeb7e1
...
@@ -663,7 +663,7 @@ namespace dlib
...
@@ -663,7 +663,7 @@ namespace dlib
alias_tensor_instance
operator
()
(
alias_tensor_instance
operator
()
(
tensor
&
t
,
tensor
&
t
,
size_t
offset
size_t
offset
);
)
const
;
/*!
/*!
requires
requires
- offset+size() <= t.size()
- offset+size() <= t.size()
...
@@ -684,7 +684,7 @@ namespace dlib
...
@@ -684,7 +684,7 @@ namespace dlib
alias_tensor_const_instance
operator
()
(
alias_tensor_const_instance
operator
()
(
const
tensor
&
t
,
const
tensor
&
t
,
size_t
offset
size_t
offset
);
)
const
;
/*!
/*!
requires
requires
- offset+size() <= t.size()
- offset+size() <= t.size()
...
...
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