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
6008ad21
Commit
6008ad21
authored
Jun 11, 2016
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made the resizable_tensor's assignment operator work in a more sensible way.
parent
7272bc74
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
57 deletions
+9
-57
tensor.h
dlib/dnn/tensor.h
+2
-21
tensor_abstract.h
dlib/dnn/tensor_abstract.h
+7
-36
No files found.
dlib/dnn/tensor.h
View file @
6008ad21
...
@@ -332,31 +332,12 @@ namespace dlib
...
@@ -332,31 +332,12 @@ namespace dlib
const
matrix_exp
<
EXP
>&
item
const
matrix_exp
<
EXP
>&
item
)
)
{
{
set_size
(
item
.
nr
(),
item
.
nc
());
if
(
!
(
num_samples
()
==
item
.
nr
()
&&
k
()
*
nr
()
*
nc
()
==
item
.
nc
()))
set_size
(
item
.
nr
(),
item
.
nc
());
tensor
::
operator
=
(
item
);
tensor
::
operator
=
(
item
);
return
*
this
;
return
*
this
;
}
}
template
<
typename
EXP
>
resizable_tensor
&
operator
+=
(
const
matrix_exp
<
EXP
>&
item
)
{
set_size
(
item
.
nr
(),
item
.
nc
());
tensor
::
operator
+=
(
item
);
return
*
this
;
}
template
<
typename
EXP
>
resizable_tensor
&
operator
-=
(
const
matrix_exp
<
EXP
>&
item
)
{
set_size
(
item
.
nr
(),
item
.
nc
());
tensor
::
operator
-=
(
item
);
return
*
this
;
}
void
set_size
(
void
set_size
(
long
n_
,
long
k_
=
1
,
long
nr_
=
1
,
long
nc_
=
1
long
n_
,
long
k_
=
1
,
long
nr_
=
1
,
long
nc_
=
1
)
)
...
...
dlib/dnn/tensor_abstract.h
View file @
6008ad21
...
@@ -495,45 +495,16 @@ namespace dlib
...
@@ -495,45 +495,16 @@ namespace dlib
requires
requires
- item contains float values
- item contains float values
ensures
ensures
- #num_samples() == item.nr()
- if (num_samples() == item.nr() && k()*nr()*nc() == item.nc()) then
- #k() == item.nc()
- the dimensions of this tensor are not changed
- #nr() == 1
- else
- #nc() == 1
- #num_samples() == item.nr()
- #k() == item.nc()
- #nr() == 1
- #nc() == 1
- Assigns item to *this tensor by performing:
- Assigns item to *this tensor by performing:
set_ptrm(host(), num_samples(), k()*nr()*nc()) = item;
set_ptrm(host(), num_samples(), k()*nr()*nc()) = item;
!*/
!*/
template
<
typename
EXP
>
resizable_tensor
&
operator
+=
(
const
matrix_exp
<
EXP
>&
item
);
/*!
requires
- item contains float values
ensures
- #num_samples() == item.nr()
- #k() == item.nc()
- #nr() == 1
- #nc() == 1
- Adds item to *this tensor by performing:
set_ptrm(host(), num_samples(), k()*nr()*nc()) += item;
!*/
template
<
typename
EXP
>
resizable_tensor
&
operator
-=
(
const
matrix_exp
<
EXP
>&
item
);
/*!
requires
- item contains float values
ensures
- #num_samples() == item.nr()
- #k() == item.nc()
- #nr() == 1
- #nc() == 1
- Subtracts item from *this tensor by performing:
set_ptrm(host(), num_samples(), k()*nr()*nc()) -= item;
!*/
};
};
void
serialize
(
const
tensor
&
item
,
std
::
ostream
&
out
);
void
serialize
(
const
tensor
&
item
,
std
::
ostream
&
out
);
...
...
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