Skip to content
Snippets Groups Projects
Commit b775a82c authored by Jerome Hue's avatar Jerome Hue
Browse files

Make a local function static

Also remove some meaningless comments
parent 985fb609
No related branches found
No related tags found
No related merge requests found
Pipeline #67020 passed
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include "aidge/data/Spikegen.hpp" #include "aidge/data/Spikegen.hpp"
namespace Aidge { namespace Aidge {
Tensor rateConvert(const Tensor& tensor) { static Tensor rateConvert(const Tensor& tensor) {
auto result = tensor.clone(); auto result = tensor.clone();
......
...@@ -805,21 +805,19 @@ const Tensor& Tensor::ref(std::shared_ptr<Tensor>& fallback, ...@@ -805,21 +805,19 @@ const Tensor& Tensor::ref(std::shared_ptr<Tensor>& fallback,
Tensor Tensor::repeat(int times) const { Tensor Tensor::repeat(int times) const {
AIDGE_ASSERT(times > 0, "repeat count must be positive"); AIDGE_ASSERT(times > 0, "repeat count must be positive");
// Ensure that the source tensor is contiguous.
Tensor src = *this; Tensor src = *this;
if (not src.isContiguous()) { if (not src.isContiguous()) {
src = src.clone(); src = src.clone();
src.makeContiguous(); src.makeContiguous();
} }
// Build new dimensions: new_dims = {times} followed by current dims. // Build new dimensions: new_dims = {times} followed by current dims
std::vector<DimSize_t> newDims; std::vector<DimSize_t> newDims;
newDims.push_back(static_cast<DimSize_t>(times)); newDims.push_back(static_cast<DimSize_t>(times));
for (const auto &d : dims()) { for (const auto &d : dims()) {
newDims.push_back(d); newDims.push_back(d);
} }
// Create an output tensor with the new dimensions.
Tensor out(newDims); Tensor out(newDims);
out.setDataType(dataType(), false); out.setDataType(dataType(), false);
out.setDataFormat(dataFormat()); out.setDataFormat(dataFormat());
...@@ -829,7 +827,6 @@ Tensor Tensor::repeat(int times) const { ...@@ -829,7 +827,6 @@ Tensor Tensor::repeat(int times) const {
// Each "block" is a copy of the data from the original tensor. // Each "block" is a copy of the data from the original tensor.
const std::size_t block = src.size(); const std::size_t block = src.size();
// Loop over the repeat count and copy the block each time.
for (int i = 0; i < times; ++i) { for (int i = 0; i < times; ++i) {
// out.getImpl()->copy(source pointer, number of elements, destination offset) // out.getImpl()->copy(source pointer, number of elements, destination offset)
out.getImpl()->copy(src.getImpl()->rawPtr(src.getImplOffset()), out.getImpl()->copy(src.getImpl()->rawPtr(src.getImplOffset()),
......
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