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

[MIN][DOX]

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