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
f1d56167
Commit
f1d56167
authored
1 year ago
by
Olivier BICHLER
Browse files
Options
Downloads
Patches
Plain Diff
Clarified resize() behavior
parent
950d8673
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
include/aidge/data/Tensor.hpp
+19
-3
19 additions, 3 deletions
include/aidge/data/Tensor.hpp
with
19 additions
and
3 deletions
include/aidge/data/Tensor.hpp
+
19
−
3
View file @
f1d56167
...
...
@@ -446,9 +446,15 @@ class Tensor : public Data,
constexpr
std
::
size_t
sizeM1
()
const
{
return
mSizeM1
;
}
/**
* @brief Change the shape of the Tensor object according to the given argument.
* @tparam DIM new dimensions.
* @param dims
* @brief Change the dimensions of the Tensor object according to the given argument.
* If the overall size is not changed (meaning we actually only performed a
* reshape), data is garanteed to remain valid.
* Otherwise, no garantee is provided regarding the validy of previous data
* (unlike std::vector). If the new overall size is larger than the previous
* one, all previous data is invalided. Otherwise, previous data may or may
* not remain valid, depending on the backend implementation.
* @tparam DIM Number of dimensions.
* @param dims New dimensions
*/
template
<
std
::
array
<
DimSize_t
,
1
>
::
size_type
DIM
>
// deducing std::array size_type and declaring DIM accordingly
void
resize
(
const
std
::
array
<
DimSize_t
,
DIM
>
&
dims
)
{
...
...
@@ -457,6 +463,16 @@ class Tensor : public Data,
computeSize
();
}
/**
* @brief Change the dimensions of the Tensor object according to the given argument.
* If the overall size is not changed (meaning we actually only performed a
* reshape), data is garanteed to remain valid.
* Otherwise, no garantee is provided regarding the validy of previous data
* (unlike std::vector). If the new overall size is larger than the previous
* one, all previous data is invalided. Otherwise, previous data may or may
* not remain valid, depending on the backend implementation.
* @param dims New dimensions
*/
void
resize
(
const
std
::
vector
<
DimSize_t
>
&
dims
)
{
mDims
=
dims
;
computeSize
();
...
...
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