Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
8f3e8a6c
Commit
8f3e8a6c
authored
Jun 12, 2016
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made mat() work on empty tensors.
parent
dd8bf755
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
13 deletions
+12
-13
tensor.h
dlib/dnn/tensor.h
+6
-8
tensor_abstract.h
dlib/dnn/tensor_abstract.h
+6
-5
No files found.
dlib/dnn/tensor.h
View file @
8f3e8a6c
...
...
@@ -192,9 +192,9 @@ namespace dlib
long
nc
)
{
DLIB_ASSERT
(
nr
>
0
&&
nc
>
0
,
DLIB_ASSERT
(
nr
>
=
0
&&
nc
>=
0
,
"
\t
const matrix_exp mat(tensor, nr, nc)"
<<
"
\n\t
nr and nc must be
bigger than
0"
<<
"
\n\t
nr and nc must be
>=
0"
<<
"
\n\t
nr: "
<<
nr
<<
"
\n\t
nc: "
<<
nc
);
...
...
@@ -212,12 +212,10 @@ namespace dlib
const
tensor
&
t
)
{
DLIB_ASSERT
(
t
.
size
()
!=
0
,
"
\t
const matrix_exp mat(tensor)"
<<
"
\n\t
The tensor can't be empty."
);
return
mat
(
t
,
t
.
num_samples
(),
t
.
size
()
/
t
.
num_samples
());
if
(
t
.
size
()
!=
0
)
return
mat
(
t
,
t
.
num_samples
(),
t
.
size
()
/
t
.
num_samples
());
else
return
mat
((
float
*
)
0
,
0
,
0
);
}
inline
const
matrix_op
<
op_pointer_to_mat
<
float
>
>
image_plane
(
...
...
dlib/dnn/tensor_abstract.h
View file @
8f3e8a6c
...
...
@@ -333,8 +333,8 @@ namespace dlib
);
/*!
requires
- nr > 0
- nc > 0
- nr >
=
0
- nc >
=
0
- nr*nc == t.size()
ensures
- returns a matrix M such that:
...
...
@@ -350,10 +350,11 @@ namespace dlib
const
tensor
&
t
);
/*!
requires
- t.size() != 0
ensures
- returns mat(t, t.num_samples(), t.size()/t.num_samples())
- if (t.size() != 0) then
- returns mat(t, t.num_samples(), t.size()/t.num_samples())
- else
- returns an empty matrix.
!*/
const
matrix_exp
image_plane
(
...
...
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