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
0f840db3
Commit
0f840db3
authored
Dec 08, 2015
by
Davis King
Browse files
saving tests for add()
parent
3559f785
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
0 deletions
+51
-0
dlib/test/dnn.cpp
dlib/test/dnn.cpp
+51
-0
No files found.
dlib/test/dnn.cpp
View file @
0f840db3
...
@@ -414,6 +414,57 @@ namespace
...
@@ -414,6 +414,57 @@ namespace
tt
::
multiply
(
dest
,
A
,
B
);
tt
::
multiply
(
dest
,
A
,
B
);
DLIB_TEST
(
max
(
abs
(
mat
(
dest
)
-
pointwise_multiply
(
AA
,
mat
(
B
))))
<
1e-6
);
DLIB_TEST
(
max
(
abs
(
mat
(
dest
)
-
pointwise_multiply
(
AA
,
mat
(
B
))))
<
1e-6
);
}
}
{
resizable_tensor
A
,
B
;
A
.
set_size
(
2
,
3
);
B
.
set_size
(
2
,
3
);
tensor_rand
rnd
;
rnd
.
fill_uniform
(
A
);
rnd
.
fill_uniform
(
B
);
matrix
<
float
>
truth
;
truth
=
2
*
mat
(
A
)
+
3
*
mat
(
B
);
tt
::
add
(
2
,
A
,
3
,
B
);
DLIB_TEST
(
max
(
abs
(
mat
(
A
)
-
truth
))
<
1e-6
);
rnd
.
fill_uniform
(
A
);
rnd
.
fill_uniform
(
B
);
truth
=
0
*
mat
(
A
)
+
3
*
mat
(
B
);
tt
::
add
(
0
,
A
,
3
,
B
);
DLIB_TEST
(
max
(
abs
(
mat
(
A
)
-
truth
))
<
1e-6
);
rnd
.
fill_uniform
(
A
);
rnd
.
fill_uniform
(
B
);
truth
=
1
*
mat
(
A
)
+
0
*
mat
(
B
);
tt
::
add
(
1
,
A
,
0
,
B
);
DLIB_TEST
(
max
(
abs
(
mat
(
A
)
-
truth
))
<
1e-6
);
rnd
.
fill_uniform
(
A
);
rnd
.
fill_uniform
(
B
);
truth
=
0
*
mat
(
A
)
+
0
*
mat
(
B
);
tt
::
add
(
0
,
A
,
0
,
B
);
DLIB_TEST
(
max
(
abs
(
mat
(
A
)
-
truth
))
<
1e-6
);
B
.
set_size
(
1
,
3
);
rnd
.
fill_uniform
(
A
);
rnd
.
fill_uniform
(
B
);
truth
=
2
*
mat
(
A
)
+
3
*
join_cols
(
mat
(
B
),
mat
(
B
));
tt
::
add
(
2
,
A
,
3
,
B
);
DLIB_TEST
(
max
(
abs
(
mat
(
A
)
-
truth
))
<
1e-6
);
B
.
set_size
(
2
,
1
);
rnd
.
fill_uniform
(
A
);
rnd
.
fill_uniform
(
B
);
truth
=
2
*
mat
(
A
)
+
3
*
join_rows
(
mat
(
B
),
join_rows
(
mat
(
B
),
mat
(
B
)));
tt
::
add
(
2
,
A
,
3
,
B
);
DLIB_TEST
(
max
(
abs
(
mat
(
A
)
-
truth
))
<
1e-6
);
}
}
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
...
...
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