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
a07cc86a
"notebooks/git@developer.sourcefind.cn:OpenDAS/dgl.git" did not exist on "324fd976189aacbccd681f12e1e675173d96d3ad"
Commit
a07cc86a
authored
Dec 01, 2015
by
Davis King
Browse files
Added tests for the alias_tensor.
parent
6a21d80b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
0 deletions
+35
-0
dlib/test/dnn.cpp
dlib/test/dnn.cpp
+35
-0
No files found.
dlib/test/dnn.cpp
View file @
a07cc86a
...
@@ -345,6 +345,41 @@ namespace
...
@@ -345,6 +345,41 @@ namespace
dlog
<<
LINFO
<<
truth5
;
dlog
<<
LINFO
<<
truth5
;
threshold
(
B
,
0.1
);
threshold
(
B
,
0.1
);
DLIB_TEST
(
max
(
abs
(
truth5
-
mat
(
B
)))
<
1e-5
);
DLIB_TEST
(
max
(
abs
(
truth5
-
mat
(
B
)))
<
1e-5
);
int
cnt
=
0
;
for
(
auto
&
x
:
A
)
x
=
cnt
++
;
truth1
.
set_size
(
2
,
2
);
truth2
.
set_size
(
2
,
2
);
truth3
.
set_size
(
2
,
2
);
truth1
=
0
,
1
,
2
,
3
;
truth2
=
4
,
5
,
6
,
7
;
truth3
=
8
,
9
,
10
,
11
;
alias_tensor
at
(
2
,
2
);
auto
A0
=
at
(
A
,
0
);
auto
A4
=
at
(
A
,
4
);
auto
A8
=
at
(
A
,
8
);
DLIB_TEST
(
mat
(
A0
)
==
truth1
);
DLIB_TEST
(
mat
(
at
(
A
,
4
))
==
truth2
);
DLIB_TEST
(
mat
(
A8
)
==
truth3
);
A4
+=
uniform_matrix
<
float
>
(
2
,
2
,
2
);
truth2
+=
2
;
DLIB_TEST
(
mat
(
A4
)
==
truth2
);
truth1
=
trans
(
reshape_to_column_vector
(
truth1
));
truth2
=
trans
(
reshape_to_column_vector
(
truth2
));
truth3
=
trans
(
reshape_to_column_vector
(
truth3
));
DLIB_TEST
(
mat
(
A
)
==
join_cols
(
truth1
,
join_cols
(
truth2
,
truth3
)));
affine_transform
(
A
,
A
,
1
,
2
);
truth1
+=
2
;
truth2
+=
2
;
truth3
+=
2
;
DLIB_TEST
(
mat
(
at
(
A
,
4
))
==
reshape
(
truth2
,
2
,
2
));
DLIB_TEST
(
mat
(
A
)
==
join_cols
(
truth1
,
join_cols
(
truth2
,
truth3
)));
}
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
...
...
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