Skip to content
Snippets Groups Projects
Commit fd3f8a3b authored by Jerome Hue's avatar Jerome Hue Committed by Maxence Naud
Browse files

Make a local function static

Also remove some meaningless comments
parent 7bb39405
No related branches found
No related tags found
1 merge request!351feat: add rate spikegen for snns
Pipeline #67061 passed
......@@ -15,7 +15,7 @@
#include "aidge/data/Spikegen.hpp"
namespace Aidge {
Tensor rateConvert(const Tensor& tensor) {
static Tensor rateConvert(const Tensor& tensor) {
auto result = tensor.clone();
......
......@@ -805,21 +805,19 @@ const Tensor& Tensor::ref(std::shared_ptr<Tensor>& fallback,
Tensor Tensor::repeat(int times) const {
AIDGE_ASSERT(times > 0, "repeat count must be positive");
// Ensure that the source tensor is contiguous.
Tensor src = *this;
if (not src.isContiguous()) {
src = src.clone();
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;
newDims.push_back(static_cast<DimSize_t>(times));
for (const auto &d : dims()) {
newDims.push_back(d);
}
// Create an output tensor with the new dimensions.
Tensor out(newDims);
out.setDataType(dataType(), false);
out.setDataFormat(dataFormat());
......@@ -829,7 +827,6 @@ Tensor Tensor::repeat(int times) const {
// Each "block" is a copy of the data from the original tensor.
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) {
// out.getImpl()->copy(source pointer, number of elements, destination offset)
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