Skip to content
Snippets Groups Projects
Commit c15bf948 authored by laurent soulier's avatar laurent soulier
Browse files

[MIN][DOX]

parent 216d6948
No related branches found
No related tags found
1 merge request!9Refactoring Tensor
Pipeline #33044 failed
...@@ -21,6 +21,7 @@ public: ...@@ -21,6 +21,7 @@ public:
/// @param i_FirstDataCoordinates Logical coordinates of the data at null natural /// @param i_FirstDataCoordinates Logical coordinates of the data at null natural
/// coordinates /// coordinates
/// @param i_Dimensions Tensor dimensions /// @param i_Dimensions Tensor dimensions
/// @sa Coord_t
TensorImpl_cpu( TensorImpl_cpu(
DataType const i_DataType, DataType const i_DataType,
std::vector<Coord_t> const &i_FirstDataCoordinates, std::vector<Coord_t> const &i_FirstDataCoordinates,
...@@ -97,11 +98,7 @@ public: ...@@ -97,11 +98,7 @@ public:
if (ptr) if (ptr)
{ {
ptr->cloneProperties(*this); ptr->cloneProperties(*this);
NbElts_t n = std::accumulate( NbElts_t n = getNbElts();
std::begin(getDimensions()),
std::end(getDimensions()),
1,
std::multiplies<NbElts_t>());
ptr->copy(getDataAddress(), n); ptr->copy(getDataAddress(), n);
} }
return detail::pimpl::ImplPtr_t(ptr); return detail::pimpl::ImplPtr_t(ptr);
......
...@@ -24,7 +24,6 @@ template<typename Data_T> bool MakeRainbow(Tensor &i_Tensor) ...@@ -24,7 +24,6 @@ template<typename Data_T> bool MakeRainbow(Tensor &i_Tensor)
{ {
NbElts_t N = i_Tensor.size(); NbElts_t N = i_Tensor.size();
Data_T *data = reinterpret_cast<Data_T *>(i_Tensor.getImpl().rawPtr()); Data_T *data = reinterpret_cast<Data_T *>(i_Tensor.getImpl().rawPtr());
Data_T *end = data + N;
for (std::size_t i = 0; i < N; ++i, ++data) for (std::size_t i = 0; i < N; ++i, ++data)
{ {
*data = i; *data = i;
...@@ -189,12 +188,11 @@ TEST_CASE("Tensor extract") ...@@ -189,12 +188,11 @@ TEST_CASE("Tensor extract")
{ {
SECTION("shallow extract") SECTION("shallow extract")
{ {
// Tensor Rainbow; Tensor Rainbow;
// Rainbow.resize({2, 4, 5}); Rainbow.resize({2, 4, 5});
// Rainbow.setDatatype(DataType::UInt16); Rainbow.setDatatype(DataType::UInt16);
// Rainbow.setBackend("cpu"); Rainbow.setBackend("cpu");
// MakeRainbow<std::uint16_t>(Rainbow); MakeRainbow<std::uint16_t>(Rainbow);
// Tensor view(Rainbow, {2, 2, 3}, {0, 1, 1}); // Tensor view(Rainbow, {2, 2, 3}, {0, 1, 1});
// for (Coord_t a = 0; a < view.dims()[0]; ++a) // for (Coord_t a = 0; a < view.dims()[0]; ++a)
// { // {
......
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