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
f0100a63
Commit
f0100a63
authored
1 year ago
by
Maxence Naud
Browse files
Options
Downloads
Patches
Plain Diff
[Fix] missing include in Scaling_Op kernel
parent
782a87ec
No related branches found
No related tags found
1 merge request
!23
Tiling
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
include/aidge/backend/cpu/operator/ScalingImpl_forward_kernels.hpp
+12
-10
12 additions, 10 deletions
...idge/backend/cpu/operator/ScalingImpl_forward_kernels.hpp
with
12 additions
and
10 deletions
include/aidge/backend/cpu/operator/ScalingImpl_forward_kernels.hpp
+
12
−
10
View file @
f0100a63
...
...
@@ -9,11 +9,12 @@
*
********************************************************************************/
#ifndef
__
AIDGE_CPU_OPERATOR_S
caling
IMPL_FORWARD_KERNEL_H
__
#define
__
AIDGE_CPU_OPERATOR_S
caling
IMPL_FORWARD_KERNEL_H
__
#ifndef AIDGE_CPU_OPERATOR_S
CALING
IMPL_FORWARD_KERNEL_H
#define AIDGE_CPU_OPERATOR_S
CALING
IMPL_FORWARD_KERNEL_H
#include
<cmath>
#include
<cstddef>
#include
"aidge/utils/Registrar.hpp"
#include
"aidge/backend/cpu/operator/ScalingImpl.hpp"
//TODO : improve propagate, n2d2 :
...
...
@@ -59,12 +60,13 @@ const O& clamp(const O& x, const O& min, const O& max)
}
template
<
class
O
>
O
saturate
(
O
value
,
std
::
size_t
quantizedNbBits
,
bool
isOutputUnsigned
)
{
O
saturate
(
const
O
value
,
const
std
::
size_t
quantizedNbBits
,
const
bool
isOutputUnsigned
)
{
// TODO: no assertions in kernel
assert
(
quantizedNbBits
>
0
);
const
O
min
=
isOutputUnsigned
?
0
:
const
O
min
=
isOutputUnsigned
?
0
:
-
(
1ll
<<
(
quantizedNbBits
-
1ll
));
const
O
max
=
isOutputUnsigned
?
(
1ll
<<
quantizedNbBits
)
-
1ll
:
const
O
max
=
isOutputUnsigned
?
(
1ll
<<
quantizedNbBits
)
-
1ll
:
(
1ll
<<
(
quantizedNbBits
-
1ll
))
-
1ll
;
return
clamp
(
value
,
min
,
max
);
...
...
@@ -79,8 +81,8 @@ void ScalingImpl_cpu_forward_kernel(const Scaling_Op::Attrs& attrs,
const
I
*
input
=
static_cast
<
const
I
*>
(
input_
);
O
*
output
=
static_cast
<
O
*>
(
output_
);
const
I
&
scalingFactor
=
static_cast
<
const
I
&>
(
std
::
get
<
0
>
(
attrs
));
std
::
size_t
quantizedNbBits
=
static_cast
<
std
::
size_t
>
(
std
::
get
<
1
>
(
attrs
));
bool
isOutputUnsigned
=
static_cast
<
bool
>
(
std
::
get
<
2
>
(
attrs
));
const
std
::
size_t
quantizedNbBits
=
static_cast
<
std
::
size_t
>
(
std
::
get
<
1
>
(
attrs
));
const
bool
isOutputUnsigned
=
static_cast
<
bool
>
(
std
::
get
<
2
>
(
attrs
));
for
(
std
::
size_t
i
=
0
;
i
<
inputLenght
;
++
i
)
{
output
[
i
]
=
input
[
i
]
*
scalingFactor
;
...
...
@@ -101,4 +103,4 @@ static Registrar<ScalingImplForward_cpu> registrarScalingImplForward_cpu_Float64
}
// namespace
}
// namespace Aidge
#endif
/*
__
AIDGE_CPU_OPERATOR_S
caling
IMPL_FORWARD_KERNEL_H
__
*/
#endif
/* AIDGE_CPU_OPERATOR_S
CALING
IMPL_FORWARD_KERNEL_H */
\ No newline at end of file
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