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
Merge requests
!104
update Resize operator
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
update Resize operator
feat_enhance_operator_resize_support
into
dev
Overview
0
Commits
8
Pipelines
17
Changes
10
Merged
Maxence Naud
requested to merge
feat_enhance_operator_resize_support
into
dev
4 months ago
Overview
0
Commits
8
Pipelines
17
Changes
10
Expand
Context
issue :
aidge#181 (closed)
Modified files
Detailed major modifications
TODO
kernel works but should be reworked
Edited
4 months ago
by
Maxence Naud
0
0
Merge request reports
Compare
dev
version 7
96e4459f
4 months ago
version 6
2b101ae8
4 months ago
version 5
2d7efcd3
4 months ago
version 4
1fabaeb8
4 months ago
version 3
8591f61f
4 months ago
version 2
3e10b5a3
4 months ago
version 1
cc2b9538
4 months ago
dev (base)
and
version 2
latest version
6a6d3f6a
8 commits,
4 months ago
version 7
96e4459f
7 commits,
4 months ago
version 6
2b101ae8
6 commits,
4 months ago
version 5
2d7efcd3
5 commits,
4 months ago
version 4
1fabaeb8
5 commits,
4 months ago
version 3
8591f61f
4 commits,
4 months ago
version 2
3e10b5a3
3 commits,
4 months ago
version 1
cc2b9538
3 commits,
4 months ago
10 files
+
1271
−
1
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
10
Search (e.g. *.vue) (Ctrl+P)
include/aidge/backend/cpu/data/Interpolation.hpp
0 → 100644
+
117
−
0
Options
/********************************************************************************
* Copyright (c) 2024 CEA-List
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*
********************************************************************************/
#ifndef AIDGE_CPU_DATA_INTERPOLATION_H_
#define AIDGE_CPU_DATA_INTERPOLATION_H_
#include
<vector>
#include
<aidge/data/Interpolation.hpp>
#include
<aidge/utils/Types.h>
namespace
Aidge
{
class
InterpolationCPU
:
public
Interpolation
{
public:
/*
* @brief Interpolates values given via input in given mode.
*
* Values are contiguously arranged in a "square" shape around the point to
* interpolate. Depending on interpolation mode.
* The point that will be interpolated is located right in the
* middle of all points.
* Immediate neighbours :
* 1D interp : 2D interp :
* . . . . . .
* . . 1 2 . . . . . . . .
* . . 1 2 . .
* . . 3 4 . .
* . . . . . .
* . . . . . .
*
* 2 neighbours :
* 1D interp : 2D interp :
* . . . . . . . .
* . . . . . . . .
* . . 1 2 3 4 . . . . 1 2 3 4 . .
* . . 5 6 7 8 . .
* . . 9 10 11 12 . .
* . . 13 14 15 16 . .
* . . . . . . . .
* . . . . . . . .
*
* @param[in] originalCoords: coord of the point to interpolate in the
* original picture. These coords are generated with
* Interpolation::untransformCoords(coordsInInterpolatedTensor)
* @param[in] points : points to interpolate, arranged in a vector of a
* pairs ((point_coord), value) :
* [[[X1, X2, ..., XN], Xval], ...., [[A1, A2, ..., AN],Aval]].
* With :
* - N: the number of dimensions.
* - A: the number of points of the grid to interpolate.
* - All coordinates expressed in originalTensor frame.
* @param[in] interpMode: interpolation mode
* @return interpolated value
*/
template
<
typename
T
>
static
T
interpolate
(
const
std
::
vector
<
float
>
&
coordsToInterpolate
,
const
std
::
set
<
Point
<
T
>>
&
points
,
const
Mode
interpMode
=
Interpolation
::
Mode
::
Linear
);
/**
* @brief performs linear interpolation on given points.
* @param[in] values: values to interpolate, since we only do an average of
* all values, their indexes isn't useful.
* @return interpolated value
*/
template
<
typename
T
>
static
T
linear
(
const
std
::
vector
<
float
>
&
originalCoords
,
const
std
::
set
<
Point
<
T
>>
&
points
);
/**
* @brief performs nearest interpolation on given points.
* @note it is a wrapper for linearRecurse() private method
* @param[in] coordsToInterpolate: coordinates to interpolate
* @param[in] points: points to interpolate
* @param[in] interpMode: interpolation method, must be a Nearest...
* otherwise function will throw an error.
* @return interpolated value
*/
template
<
typename
T
>
static
T
nearest
(
const
std
::
vector
<
float
>
&
coordsToInterpolate
,
const
std
::
set
<
Point
<
T
>>
&
points
,
const
Interpolation
::
Mode
nearestMode
);
private:
/**
* @brief actual linear interpolation function.
* will :
* - Split all points along each dimension depending of if their coords at
* idx alongDim are above or under coordsToInterpolate until they are
* 1-to-1.
* - Perform interpolation in 2 leftover points and return interpolated
* point to parent call with a set of size 1.
* - repeat until all dimensions have been interpolated.
* @param[in] coordsToInterpolate: coordinates to interpolate
* @param[in] points: points to interpolate
* @param[in] alongDim: discriminant on along which dimension are being
* segregated.
* @return
*/
template
<
typename
T
>
static
std
::
set
<
Interpolation
::
Point
<
T
>>
linearRecurse
(
const
std
::
vector
<
float
>
&
coordsToInterpolate
,
const
std
::
set
<
Point
<
T
>>
&
points
,
const
DimIdx_t
alongDim
=
0
);
};
}
// namespace Aidge
#endif // AIDGE_CPU_DATA_INTERPOLATION_H_
Loading