Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
aidge
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
Julien Girard-Satabin
aidge
Commits
ccb95742
Commit
ccb95742
authored
1 year ago
by
Vincent Templier
Browse files
Options
Downloads
Patches
Plain Diff
Change ref_cpp reference to cpu in Core library
parent
d53be88f
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aidge/_Core/include/data/Tensor.hpp
+8
-8
8 additions, 8 deletions
aidge/_Core/include/data/Tensor.hpp
aidge/_Core/python_binding/data/pybind_Tensor.cpp
+2
-2
2 additions, 2 deletions
aidge/_Core/python_binding/data/pybind_Tensor.cpp
with
10 additions
and
10 deletions
aidge/_Core/include/data/Tensor.hpp
+
8
−
8
View file @
ccb95742
...
@@ -139,7 +139,7 @@ class Tensor : public Data,
...
@@ -139,7 +139,7 @@ class Tensor : public Data,
:
Data
(
Type
),
:
Data
(
Type
),
mDims
({
SIZE_0
}),
mDims
({
SIZE_0
}),
mDataType
(
NativeType
<
T
>::
type
),
mDataType
(
NativeType
<
T
>::
type
),
mImpl
(
Registrar
<
Tensor
>::
create
({
"
ref_
cp
p
"
,
NativeType
<
T
>::
type
})(
*
this
)),
mImpl
(
Registrar
<
Tensor
>::
create
({
"cp
u
"
,
NativeType
<
T
>::
type
})(
*
this
)),
mSize
(
SIZE_0
),
mSize
(
SIZE_0
),
mSizeM1
(
SIZE_0
)
{
mSizeM1
(
SIZE_0
)
{
mImpl
->
copy
(
&
arr
.
data
[
0
],
SIZE_0
);
mImpl
->
copy
(
&
arr
.
data
[
0
],
SIZE_0
);
...
@@ -149,7 +149,7 @@ class Tensor : public Data,
...
@@ -149,7 +149,7 @@ class Tensor : public Data,
constexpr
Tensor
&
operator
=
(
Array1D
<
T
,
SIZE_0
>
&&
arr
)
{
constexpr
Tensor
&
operator
=
(
Array1D
<
T
,
SIZE_0
>
&&
arr
)
{
resize
({
SIZE_0
});
resize
({
SIZE_0
});
if
(
!
mImpl
)
{
if
(
!
mImpl
)
{
mImpl
=
Registrar
<
Tensor
>::
create
({
"
ref_
cp
p
"
,
NativeType
<
T
>::
type
})(
*
this
);
mImpl
=
Registrar
<
Tensor
>::
create
({
"cp
u
"
,
NativeType
<
T
>::
type
})(
*
this
);
}
}
mImpl
->
copy
(
&
arr
.
data
[
0
],
SIZE_0
);
mImpl
->
copy
(
&
arr
.
data
[
0
],
SIZE_0
);
return
*
this
;
return
*
this
;
...
@@ -159,7 +159,7 @@ class Tensor : public Data,
...
@@ -159,7 +159,7 @@ class Tensor : public Data,
:
Data
(
Type
),
:
Data
(
Type
),
mDims
({
SIZE_0
,
SIZE_1
}),
mDims
({
SIZE_0
,
SIZE_1
}),
mDataType
(
NativeType
<
T
>::
type
),
mDataType
(
NativeType
<
T
>::
type
),
mImpl
(
Registrar
<
Tensor
>::
create
({
"
ref_
cp
p
"
,
NativeType
<
T
>::
type
})(
*
this
)),
mImpl
(
Registrar
<
Tensor
>::
create
({
"cp
u
"
,
NativeType
<
T
>::
type
})(
*
this
)),
mSize
(
SIZE_0
*
SIZE_1
),
mSize
(
SIZE_0
*
SIZE_1
),
mSizeM1
(
SIZE_1
)
{
mSizeM1
(
SIZE_1
)
{
mImpl
->
copy
(
&
arr
.
data
[
0
][
0
],
SIZE_0
*
SIZE_1
);
mImpl
->
copy
(
&
arr
.
data
[
0
][
0
],
SIZE_0
*
SIZE_1
);
...
@@ -169,7 +169,7 @@ class Tensor : public Data,
...
@@ -169,7 +169,7 @@ class Tensor : public Data,
constexpr
Tensor
&
operator
=
(
Array2D
<
T
,
SIZE_0
,
SIZE_1
>
&&
arr
)
{
constexpr
Tensor
&
operator
=
(
Array2D
<
T
,
SIZE_0
,
SIZE_1
>
&&
arr
)
{
resize
({
SIZE_0
,
SIZE_1
});
resize
({
SIZE_0
,
SIZE_1
});
if
(
!
mImpl
)
{
if
(
!
mImpl
)
{
mImpl
=
Registrar
<
Tensor
>::
create
({
"
ref_
cp
p
"
,
NativeType
<
T
>::
type
})(
*
this
);
mImpl
=
Registrar
<
Tensor
>::
create
({
"cp
u
"
,
NativeType
<
T
>::
type
})(
*
this
);
}
}
mImpl
->
copy
(
&
arr
.
data
[
0
][
0
],
SIZE_0
*
SIZE_1
);
mImpl
->
copy
(
&
arr
.
data
[
0
][
0
],
SIZE_0
*
SIZE_1
);
return
*
this
;
return
*
this
;
...
@@ -179,7 +179,7 @@ class Tensor : public Data,
...
@@ -179,7 +179,7 @@ class Tensor : public Data,
:
Data
(
Type
),
:
Data
(
Type
),
mDims
({
SIZE_0
,
SIZE_1
,
SIZE_2
}),
mDims
({
SIZE_0
,
SIZE_1
,
SIZE_2
}),
mDataType
(
NativeType
<
T
>::
type
),
mDataType
(
NativeType
<
T
>::
type
),
mImpl
(
Registrar
<
Tensor
>::
create
({
"
ref_
cp
p
"
,
NativeType
<
T
>::
type
})(
*
this
)),
mImpl
(
Registrar
<
Tensor
>::
create
({
"cp
u
"
,
NativeType
<
T
>::
type
})(
*
this
)),
mSize
(
SIZE_0
*
SIZE_1
*
SIZE_2
),
mSize
(
SIZE_0
*
SIZE_1
*
SIZE_2
),
mSizeM1
(
SIZE_1
*
SIZE_2
)
{
mSizeM1
(
SIZE_1
*
SIZE_2
)
{
mImpl
->
copy
(
&
arr
.
data
[
0
][
0
][
0
],
SIZE_0
*
SIZE_1
*
SIZE_2
);
mImpl
->
copy
(
&
arr
.
data
[
0
][
0
][
0
],
SIZE_0
*
SIZE_1
*
SIZE_2
);
...
@@ -189,7 +189,7 @@ class Tensor : public Data,
...
@@ -189,7 +189,7 @@ class Tensor : public Data,
constexpr
Tensor
&
operator
=
(
Array3D
<
T
,
SIZE_0
,
SIZE_1
,
SIZE_2
>
&&
arr
)
{
constexpr
Tensor
&
operator
=
(
Array3D
<
T
,
SIZE_0
,
SIZE_1
,
SIZE_2
>
&&
arr
)
{
resize
({
SIZE_0
,
SIZE_1
,
SIZE_2
});
resize
({
SIZE_0
,
SIZE_1
,
SIZE_2
});
if
(
!
mImpl
)
{
if
(
!
mImpl
)
{
mImpl
=
Registrar
<
Tensor
>::
create
({
"
ref_
cp
p
"
,
NativeType
<
T
>::
type
})(
*
this
);
mImpl
=
Registrar
<
Tensor
>::
create
({
"cp
u
"
,
NativeType
<
T
>::
type
})(
*
this
);
}
}
mImpl
->
copy
(
&
arr
.
data
[
0
][
0
][
0
],
SIZE_0
*
SIZE_1
*
SIZE_2
);
mImpl
->
copy
(
&
arr
.
data
[
0
][
0
][
0
],
SIZE_0
*
SIZE_1
*
SIZE_2
);
return
*
this
;
return
*
this
;
...
@@ -199,7 +199,7 @@ class Tensor : public Data,
...
@@ -199,7 +199,7 @@ class Tensor : public Data,
:
Data
(
Type
),
:
Data
(
Type
),
mDims
({
SIZE_0
,
SIZE_1
,
SIZE_2
,
SIZE_3
}),
mDims
({
SIZE_0
,
SIZE_1
,
SIZE_2
,
SIZE_3
}),
mDataType
(
NativeType
<
T
>::
type
),
mDataType
(
NativeType
<
T
>::
type
),
mImpl
(
Registrar
<
Tensor
>::
create
({
"
ref_
cp
p
"
,
NativeType
<
T
>::
type
})(
*
this
)),
mImpl
(
Registrar
<
Tensor
>::
create
({
"cp
u
"
,
NativeType
<
T
>::
type
})(
*
this
)),
mSize
(
SIZE_0
*
SIZE_1
*
SIZE_2
*
SIZE_3
),
mSize
(
SIZE_0
*
SIZE_1
*
SIZE_2
*
SIZE_3
),
mSizeM1
(
SIZE_1
*
SIZE_2
*
SIZE_3
)
{
mSizeM1
(
SIZE_1
*
SIZE_2
*
SIZE_3
)
{
mImpl
->
copy
(
&
arr
.
data
[
0
][
0
][
0
][
0
],
SIZE_0
*
SIZE_1
*
SIZE_2
*
SIZE_3
);
mImpl
->
copy
(
&
arr
.
data
[
0
][
0
][
0
][
0
],
SIZE_0
*
SIZE_1
*
SIZE_2
*
SIZE_3
);
...
@@ -209,7 +209,7 @@ class Tensor : public Data,
...
@@ -209,7 +209,7 @@ class Tensor : public Data,
constexpr
Tensor
&
operator
=
(
Array4D
<
T
,
SIZE_0
,
SIZE_1
,
SIZE_2
,
SIZE_3
>
&&
arr
)
{
constexpr
Tensor
&
operator
=
(
Array4D
<
T
,
SIZE_0
,
SIZE_1
,
SIZE_2
,
SIZE_3
>
&&
arr
)
{
resize
({
SIZE_0
,
SIZE_1
,
SIZE_2
,
SIZE_3
});
resize
({
SIZE_0
,
SIZE_1
,
SIZE_2
,
SIZE_3
});
if
(
!
mImpl
)
{
if
(
!
mImpl
)
{
mImpl
=
Registrar
<
Tensor
>::
create
({
"
ref_
cp
p
"
,
NativeType
<
T
>::
type
})(
*
this
);
mImpl
=
Registrar
<
Tensor
>::
create
({
"cp
u
"
,
NativeType
<
T
>::
type
})(
*
this
);
}
}
mImpl
->
copy
(
&
arr
.
data
[
0
][
0
][
0
][
0
],
SIZE_0
*
SIZE_1
*
SIZE_2
*
SIZE_3
);
mImpl
->
copy
(
&
arr
.
data
[
0
][
0
][
0
][
0
],
SIZE_0
*
SIZE_1
*
SIZE_2
*
SIZE_3
);
return
*
this
;
return
*
this
;
...
...
This diff is collapsed.
Click to expand it.
aidge/_Core/python_binding/data/pybind_Tensor.cpp
+
2
−
2
View file @
ccb95742
...
@@ -39,8 +39,8 @@ void addCtor(py::class_<Tensor,
...
@@ -39,8 +39,8 @@ void addCtor(py::class_<Tensor,
newTensor
->
resize
(
dims
);
newTensor
->
resize
(
dims
);
// TODO : Find a better way to choose backend
// TODO : Find a better way to choose backend
std
::
set
<
std
::
string
>
availableBackends
=
Tensor
::
getAvailableBackends
();
std
::
set
<
std
::
string
>
availableBackends
=
Tensor
::
getAvailableBackends
();
if
(
availableBackends
.
find
(
"
ref_
cp
p
"
)
!=
availableBackends
.
end
()){
if
(
availableBackends
.
find
(
"cp
u
"
)
!=
availableBackends
.
end
()){
newTensor
->
setBackend
(
"
ref_
cp
p
"
);
newTensor
->
setBackend
(
"cp
u
"
);
newTensor
->
getImpl
()
->
setRawPtr
(
static_cast
<
T
*>
(
info
.
ptr
));
newTensor
->
getImpl
()
->
setRawPtr
(
static_cast
<
T
*>
(
info
.
ptr
));
}
else
{
}
else
{
printf
(
"Warning : Could not use aidge_ref_cpp backend, verify you have `import aidge_ref_cpp`
\n
"
);
printf
(
"Warning : Could not use aidge_ref_cpp backend, verify you have `import aidge_ref_cpp`
\n
"
);
...
...
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