Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
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
Houssem ROUIS
aidge_core
Commits
246a0c8b
Commit
246a0c8b
authored
5 months ago
by
Grégoire Kubler
Committed by
Maxence Naud
4 months ago
Browse files
Options
Downloads
Patches
Plain Diff
feat : added padding attribute to resize operator
parent
6d809877
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
include/aidge/operator/Resize.hpp
+28
-7
28 additions, 7 deletions
include/aidge/operator/Resize.hpp
with
28 additions
and
7 deletions
include/aidge/operator/Resize.hpp
+
28
−
7
View file @
246a0c8b
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
#include
"aidge/data/Interpolation.hpp"
#include
"aidge/data/Interpolation.hpp"
#include
"aidge/graph/Node.hpp"
#include
"aidge/graph/Node.hpp"
#include
"aidge/operator/OperatorTensor.hpp"
#include
"aidge/operator/OperatorTensor.hpp"
#include
"aidge/operator/Pad.hpp"
#include
"aidge/utils/Registrar.hpp"
#include
"aidge/utils/Registrar.hpp"
#include
"aidge/utils/StaticAttributes.hpp"
#include
"aidge/utils/StaticAttributes.hpp"
#include
"aidge/utils/Types.h"
#include
"aidge/utils/Types.h"
...
@@ -36,6 +37,7 @@ enum class ResizeAttr {
...
@@ -36,6 +37,7 @@ enum class ResizeAttr {
// extrapolation_value,
// extrapolation_value,
// keep_aspect_ratio_policy,
// keep_aspect_ratio_policy,
InterpolationMode
,
InterpolationMode
,
PaddingMode
,
};
};
/**
/**
...
@@ -91,7 +93,8 @@ class Resize_Op
...
@@ -91,7 +93,8 @@ class Resize_Op
StaticAttributes
<
ResizeAttr
,
StaticAttributes
<
ResizeAttr
,
Interpolation
::
CoordinateTransformation
,
Interpolation
::
CoordinateTransformation
,
float
,
float
,
Interpolation
::
Mode
>
;
Interpolation
::
Mode
,
PadBorderType
>
;
template
<
ResizeAttr
e
>
template
<
ResizeAttr
e
>
using
attr
=
typename
Attributes_
::
template
attr
<
e
>;
using
attr
=
typename
Attributes_
::
template
attr
<
e
>;
const
std
::
shared_ptr
<
Attributes_
>
mAttributes
;
const
std
::
shared_ptr
<
Attributes_
>
mAttributes
;
...
@@ -115,10 +118,12 @@ class Resize_Op
...
@@ -115,10 +118,12 @@ class Resize_Op
* set, forward will fail.
* set, forward will fail.
* @return NodePtr
* @return NodePtr
*/
*/
explicit
Resize_Op
(
Interpolation
::
CoordinateTransformation
coordTransfoMode
,
explicit
Resize_Op
(
Interpolation
::
Mode
interpol_mode
=
Interpolation
::
CoordinateTransformation
coordTransfoMode
,
Interpolation
::
Mode
::
NearestRoundPreferFloor
,
Interpolation
::
Mode
interpol_mode
=
float
cubic_coef_a
=
-
.75
f
)
Interpolation
::
Mode
::
NearestRoundPreferFloor
,
float
cubic_coef_a
=
-
.75
f
,
PadBorderType
paddingMode
=
PadBorderType
::
Constant
)
:
OperatorTensor
(
Type
,
:
OperatorTensor
(
Type
,
{
InputCategory
::
Data
,
{
InputCategory
::
Data
,
InputCategory
::
OptionalData
,
InputCategory
::
OptionalData
,
...
@@ -128,7 +133,8 @@ class Resize_Op
...
@@ -128,7 +133,8 @@ class Resize_Op
mAttributes
(
std
::
make_shared
<
Attributes_
>
(
mAttributes
(
std
::
make_shared
<
Attributes_
>
(
attr
<
ResizeAttr
::
CubicCoeffA
>
(
cubic_coef_a
),
attr
<
ResizeAttr
::
CubicCoeffA
>
(
cubic_coef_a
),
attr
<
ResizeAttr
::
CoordinateTransformationMode
>
(
coordTransfoMode
),
attr
<
ResizeAttr
::
CoordinateTransformationMode
>
(
coordTransfoMode
),
attr
<
ResizeAttr
::
InterpolationMode
>
(
interpol_mode
)))
{}
attr
<
ResizeAttr
::
InterpolationMode
>
(
interpol_mode
),
attr
<
ResizeAttr
::
PaddingMode
>
(
paddingMode
)))
{}
/**
/**
* @brief Copy-constructor. Copy the operator attributes and its output
* @brief Copy-constructor. Copy the operator attributes and its output
...
@@ -166,12 +172,26 @@ class Resize_Op
...
@@ -166,12 +172,26 @@ class Resize_Op
return
mAttributes
return
mAttributes
->
template
getAttr
<
ResizeAttr
::
CoordinateTransformationMode
>();
->
template
getAttr
<
ResizeAttr
::
CoordinateTransformationMode
>();
}
}
Interpolation
::
CoordinateTransformation
&
coordinateTransformationMode
()
const
noexcept
{
return
mAttributes
->
template
getAttr
<
ResizeAttr
::
CoordinateTransformationMode
>();
}
float
&
cubicCoefA
()
{
float
&
cubicCoefA
()
{
return
mAttributes
->
template
getAttr
<
ResizeAttr
::
CubicCoeffA
>();
return
mAttributes
->
template
getAttr
<
ResizeAttr
::
CubicCoeffA
>();
}
}
Interpolation
::
Mode
&
interpolation
m
ode
()
{
Interpolation
::
Mode
&
interpolation
M
ode
()
const
noexcept
{
return
mAttributes
->
template
getAttr
<
ResizeAttr
::
InterpolationMode
>();
return
mAttributes
->
template
getAttr
<
ResizeAttr
::
InterpolationMode
>();
}
}
Interpolation
::
Mode
&
interpolationMode
()
{
return
mAttributes
->
template
getAttr
<
ResizeAttr
::
InterpolationMode
>();
}
PadBorderType
&
paddingMode
()
const
noexcept
{
return
mAttributes
->
template
getAttr
<
ResizeAttr
::
PaddingMode
>();
}
PadBorderType
&
paddingMode
()
{
return
mAttributes
->
template
getAttr
<
ResizeAttr
::
PaddingMode
>();
}
// bool &excludeOutside() {
// bool &excludeOutside() {
// return mAttributes->template getAttr<ResizeAttr::excludeOutside>();
// return mAttributes->template getAttr<ResizeAttr::excludeOutside>();
// }
// }
...
@@ -199,6 +219,7 @@ class Resize_Op
...
@@ -199,6 +219,7 @@ class Resize_Op
* used if interpolation_mode = Interpolation::Mode::Cubic
* used if interpolation_mode = Interpolation::Mode::Cubic
* @warning Scales & ROI input cannot be set simultaneously. If bot are set,
* @warning Scales & ROI input cannot be set simultaneously. If bot are set,
* forward will fail.
* forward will fail.
* @warning Padding mode will tell how values out of bound are treated.
* @return NodePtr
* @return NodePtr
*/
*/
std
::
shared_ptr
<
Node
>
std
::
shared_ptr
<
Node
>
...
...
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