Skip to content
Snippets Groups Projects
Commit b404f66e authored by Maxence Naud's avatar Maxence Naud
Browse files

Merge branch 'dev' into 'main'

v0.1.4

Closes aidge_core#196

See merge request !25
parents a54a85e7 67601dbd
No related branches found
No related tags found
1 merge request!25v0.1.4
Pipeline #64430 passed
# Version 0.1.4 (December 6, 2024)
# Version 0.0.1 (January 23, 2024) # Version 0.0.1 (January 23, 2024)
Initial release Initial release
cmake_minimum_required(VERSION 3.15) cmake_minimum_required(VERSION 3.18)
set(CXX_STANDARD 14)
file(STRINGS "${CMAKE_SOURCE_DIR}/version.txt" version) file(STRINGS "${CMAKE_SOURCE_DIR}/version.txt" version)
...@@ -19,6 +20,7 @@ option(PYBIND "python binding" OFF) ...@@ -19,6 +20,7 @@ option(PYBIND "python binding" OFF)
option(WERROR "Warning as error" OFF) option(WERROR "Warning as error" OFF)
option(TEST "Enable tests" ON) option(TEST "Enable tests" ON)
option(COVERAGE "Enable coverage" OFF) option(COVERAGE "Enable coverage" OFF)
option(ENABLE_ASAN "Enable ASan (AddressSanitizer) for runtime analysis of memory use (over/underflow, memory leak, ...)" OFF)
############################################## ##############################################
# Import utils CMakeLists # Import utils CMakeLists
...@@ -28,6 +30,13 @@ if(CMAKE_COMPILER_IS_GNUCXX AND COVERAGE) ...@@ -28,6 +30,13 @@ if(CMAKE_COMPILER_IS_GNUCXX AND COVERAGE)
Include(CodeCoverage) Include(CodeCoverage)
endif() endif()
if(NOT $ENV{AIDGE_INSTALL} STREQUAL "")
set(CMAKE_INSTALL_PREFIX $ENV{AIDGE_INSTALL})
list(APPEND CMAKE_PREFIX_PATH $ENV{AIDGE_INSTALL})
message(WARNING "Env var AIDGE_INSTALL detected : $ENV{AIDGE_INSTALL}. Set CMAKE_INSTALL_PREFIX to AIDGE_INSTALL & added to CMAKE_PREFIX_PATH"
"\n\tCMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}"
"\n\tCMAKE_PREFIX_PATH = ${CMAKE_PREFIX_PATH}")
endif()
############################################## ##############################################
# Find system dependencies # Find system dependencies
find_package(aidge_core REQUIRED) find_package(aidge_core REQUIRED)
......
...@@ -91,10 +91,10 @@ public: ...@@ -91,10 +91,10 @@ public:
} }
void copy(const void *src, NbElts_t length, NbElts_t offset = 0) override final { void copy(const void *src, NbElts_t length, NbElts_t offset = 0) override final {
AIDGE_ASSERT(offset + length <= mNbElts, "TensorImpl_opencv<{}>::copy(): copy offset ({}) + length ({}) is above capacity ({})", typeid(T).name(), offset, length, mNbElts);
const T* srcT = static_cast<const T *>(src); const T* srcT = static_cast<const T *>(src);
T* dstT = static_cast<T *>(rawPtr(offset)); T* dstT = static_cast<T *>(rawPtr(offset));
AIDGE_ASSERT(length <= (mData.total() * mData.channels()) || length <= mNbElts, "TensorImpl_opencv<{}>::copy(): copy length ({}) is above capacity ({})", typeid(T).name(), length, mNbElts);
AIDGE_ASSERT(dstT < srcT || dstT >= srcT + length, "TensorImpl_opencv<{}>::copy(): overlapping copy is not supported", typeid(T).name()); AIDGE_ASSERT(dstT < srcT || dstT >= srcT + length, "TensorImpl_opencv<{}>::copy(): overlapping copy is not supported", typeid(T).name());
std::copy(srcT, srcT + length, dstT); std::copy(srcT, srcT + length, dstT);
...@@ -105,8 +105,8 @@ public: ...@@ -105,8 +105,8 @@ public:
return; return;
} }
AIDGE_ASSERT(offset + length <= mNbElts, "TensorImpl_opencv<{}>::copyCast(): copy offset ({}) + length ({}) is above capacity ({})", typeid(T).name(), offset, length, mNbElts);
T* dstT = static_cast<T *>(rawPtr(offset)); T* dstT = static_cast<T *>(rawPtr(offset));
AIDGE_ASSERT(length <= (mData.total() * mData.channels()) || length <= mNbElts, "TensorImpl_opencv<{}>::copyCast(): copy length ({}) is above capacity ({})", typeid(T).name(), length, mNbElts);
switch (srcDt) switch (srcDt)
{ {
case DataType::Float64: case DataType::Float64:
...@@ -171,8 +171,8 @@ public: ...@@ -171,8 +171,8 @@ public:
} }
void copyToHost(void *dst, NbElts_t length, NbElts_t offset = 0) const override final { void copyToHost(void *dst, NbElts_t length, NbElts_t offset = 0) const override final {
AIDGE_ASSERT(offset + length <= mNbElts, "TensorImpl_opencv<{}>::copyToHost(): copy offset ({}) + length ({}) is above capacity ({})", typeid(T).name(), offset, length, mNbElts);
const T* src = static_cast<const T*>(rawPtr(offset)); const T* src = static_cast<const T*>(rawPtr(offset));
AIDGE_ASSERT(length <= (mData.total() * mData.channels()) || length <= mNbElts, "TensorImpl_opencv<{}>::copyToHost(): copy length ({}) is above capacity ({})", typeid(T).name(), length, mNbElts);
std::copy(src, src + length, static_cast<T *>(dst)); std::copy(src, src + length, static_cast<T *>(dst));
} }
......
...@@ -3,7 +3,7 @@ Include(FetchContent) ...@@ -3,7 +3,7 @@ Include(FetchContent)
FetchContent_Declare( FetchContent_Declare(
Catch2 Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v3.0.1 # or a later release GIT_TAG v3.7.1 # or a later release
) )
FetchContent_MakeAvailable(Catch2) FetchContent_MakeAvailable(Catch2)
......
...@@ -21,9 +21,7 @@ using namespace Aidge; ...@@ -21,9 +21,7 @@ using namespace Aidge;
TEST_CASE("Tensor creation opencv", "[Tensor][OpenCV]") { TEST_CASE("Tensor creation opencv", "[Tensor][OpenCV]") {
SECTION("from const array") { SECTION("from const array") {
Tensor x; Tensor x;
x.setDataType(Aidge::DataType::Int32); x = Array3D<cpptype_t<DataType::Int32>,2,2,2>{
x.setBackend("opencv");
x = Array3D<int,2,2,2>{
{ {
{ {
{1, 2}, {1, 2},
...@@ -34,11 +32,10 @@ TEST_CASE("Tensor creation opencv", "[Tensor][OpenCV]") { ...@@ -34,11 +32,10 @@ TEST_CASE("Tensor creation opencv", "[Tensor][OpenCV]") {
{7, 8} {7, 8}
} }
}}; }};
x.setBackend("opencv");
Tensor xCopy; Tensor xCopy;
xCopy.setDataType(Aidge::DataType::Int32); xCopy = Array3D<cpptype_t<DataType::Int32>,2,2,2>{
xCopy.setBackend("opencv");
xCopy = Array3D<int,2,2,2>{
{ {
{ {
{1, 2}, {1, 2},
...@@ -49,10 +46,9 @@ TEST_CASE("Tensor creation opencv", "[Tensor][OpenCV]") { ...@@ -49,10 +46,9 @@ TEST_CASE("Tensor creation opencv", "[Tensor][OpenCV]") {
{7, 8} {7, 8}
} }
}}; }};
xCopy.setBackend("opencv");
Tensor xFloat; Tensor xFloat{Array3D<cpptype_t<DataType::Float32>,2,2,2>{
xFloat.setBackend("opencv");
xFloat = Array3D<float,2,2,2>{
{ {
{ {
{1., 2.}, {1., 2.},
...@@ -62,7 +58,8 @@ TEST_CASE("Tensor creation opencv", "[Tensor][OpenCV]") { ...@@ -62,7 +58,8 @@ TEST_CASE("Tensor creation opencv", "[Tensor][OpenCV]") {
{5., 6.}, {5., 6.},
{7., 8.} {7., 8.}
} }
}}; }}};
xFloat.setBackend("opencv");
SECTION("Tensor features") { SECTION("Tensor features") {
REQUIRE(x.nbDims() == 3); REQUIRE(x.nbDims() == 3);
......
0.1.3 0.1.4
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment