Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
aidge_core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Cyril Moineau
aidge_core
Commits
1671c0a4
Commit
1671c0a4
authored
11 months ago
by
Olivier BICHLER
Committed by
Maxence Naud
11 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Minimize number of copy call
parent
5a0fd94c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/operator/Slice.cpp
+21
-5
21 additions, 5 deletions
src/operator/Slice.cpp
with
21 additions
and
5 deletions
src/operator/Slice.cpp
+
21
−
5
View file @
1671c0a4
...
@@ -63,15 +63,31 @@ void Aidge::Slice_OpImpl::forward() {
...
@@ -63,15 +63,31 @@ void Aidge::Slice_OpImpl::forward() {
prodInputDims
[
nbDims
-
i
]
=
prodInputDims
[
nbDims
-
i
+
1
]
*
inputDims
[
nbDims
-
i
];
prodInputDims
[
nbDims
-
i
]
=
prodInputDims
[
nbDims
-
i
+
1
]
*
inputDims
[
nbDims
-
i
];
}
}
std
::
size_t
j
=
0
;
std
::
size_t
i
=
beginning
;
std
::
size_t
i
=
0
;
std
::
size_t
size
=
0
;
for
(;
j
<
prodSlicedDims
[
0
];)
{
std
::
size_t
offset
=
0
;
op
.
getOutput
(
0
)
->
getImpl
()
->
copy
(
op
.
getInput
(
0
)
->
getImpl
()
->
rawPtr
(
beginning
+
i
),
1
,
j
);
for
(
std
::
size_t
j
=
0
;
j
<
prodSlicedDims
[
0
];)
{
++
size
;
++
i
;
++
i
;
++
j
;
++
j
;
bool
newChunk
=
false
;
for
(
std
::
size_t
idx
=
nbDims
-
1
;
idx
>
0
;
--
idx
)
{
for
(
std
::
size_t
idx
=
nbDims
-
1
;
idx
>
0
;
--
idx
)
{
i
+=
j
%
prodSlicedDims
[
idx
]
==
0
?
substractedDims
[
idx
]
*
prodInputDims
[
idx
+
1
]
:
0
;
if
(
j
%
prodSlicedDims
[
idx
]
==
0
)
{
i
+=
substractedDims
[
idx
]
*
prodInputDims
[
idx
+
1
];
newChunk
=
true
;
}
}
}
if
(
newChunk
)
{
op
.
getOutput
(
0
)
->
getImpl
()
->
copy
(
op
.
getInput
(
0
)
->
getImpl
()
->
rawPtr
(
beginning
),
size
,
offset
);
beginning
=
i
;
offset
+=
size
;
size
=
0
;
}
}
if
(
size
>
0
)
{
op
.
getOutput
(
0
)
->
getImpl
()
->
copy
(
op
.
getInput
(
0
)
->
getImpl
()
->
rawPtr
(
beginning
),
size
,
offset
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment