Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
aidge_backend_cpu
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
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
Eclipse Projects
aidge
aidge_backend_cpu
Commits
472e2c62
Commit
472e2c62
authored
2 months ago
by
Olivier BICHLER
Browse files
Options
Downloads
Patches
Plain Diff
Optimized Fc Impl
parent
c08a3fa7
No related branches found
No related tags found
2 merge requests
!166
Update 0.5.0 -> 0.6.0
,
!158
Added OpenMP
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
include/aidge/backend/cpu/operator/FCImpl_kernels.hpp
+7
-12
7 additions, 12 deletions
include/aidge/backend/cpu/operator/FCImpl_kernels.hpp
with
7 additions
and
12 deletions
include/aidge/backend/cpu/operator/FCImpl_kernels.hpp
+
7
−
12
View file @
472e2c62
...
@@ -96,21 +96,16 @@ void FCImpl_cpu_forward_kernel(const DimSize_t batchSize,
...
@@ -96,21 +96,16 @@ void FCImpl_cpu_forward_kernel(const DimSize_t batchSize,
const
B
*
biases
=
static_cast
<
const
B
*>
(
biases_
);
const
B
*
biases
=
static_cast
<
const
B
*>
(
biases_
);
O
*
output
=
static_cast
<
O
*>
(
output_
);
O
*
output
=
static_cast
<
O
*>
(
output_
);
if
(
biases
==
nullptr
)
{
#ifdef _OPENMP
std
::
fill
(
output
,
output
+
(
batchSize
*
outputFeatureSize
),
B
(
0
));
#pragma omp parallel for collapse(2) if (batchSize * outputFeatureSize > 32)
}
#endif
else
{
for
(
int
batch
=
0
;
batch
<
static_cast
<
int
>
(
batchSize
);
++
batch
)
{
for
(
std
::
size_t
batch
=
0
;
batch
<
batchSize
;
++
batch
)
{
for
(
int
out
=
0
;
out
<
static_cast
<
int
>
(
outputFeatureSize
);
++
out
)
{
std
::
copy
(
biases
,
biases
+
outputFeatureSize
,
output
+
(
batch
*
outputFeatureSize
));
const
auto
biasVal
=
(
biases
)
?
biases
[
out
]
:
B
(
0
);
}
}
for
(
std
::
size_t
batch
=
0
;
batch
<
batchSize
;
++
batch
)
{
for
(
std
::
size_t
out
=
0
;
out
<
outputFeatureSize
;
++
out
)
{
output
[
out
+
batch
*
outputFeatureSize
]
=
std
::
inner_product
(
input
+
batch
*
inputFeatureSize
,
output
[
out
+
batch
*
outputFeatureSize
]
=
std
::
inner_product
(
input
+
batch
*
inputFeatureSize
,
input
+
(
batch
+
1
)
*
inputFeatureSize
,
input
+
(
batch
+
1
)
*
inputFeatureSize
,
weights
+
out
*
inputFeatureSize
,
weights
+
out
*
inputFeatureSize
,
output
[
out
+
batch
*
outputFeatureSize
]
);
biasVal
);
}
}
}
}
}
}
...
...
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