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

Add basic test for Spikegen functions

parent 2a40c322
No related branches found
No related tags found
No related merge requests found
Pipeline #66195 canceled
/********************************************************************************
* Copyright (c) 2025 CEA-List
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*
********************************************************************************/
#include <cstdint> // std::uint8_t, std::uint16_t, std::int32_t
#include <vector> // std::vector
#include <catch2/catch_test_macros.hpp>
#include "aidge/data/Spikegen.hpp"
#include "aidge/data/Tensor.hpp"
#include "aidge/utils/ArrayHelpers.hpp"
#include "aidge/utils/TensorUtils.hpp"
namespace Aidge
{
TEST_CASE("[core/data] SpikeGen zeros", "[SpikeGen]") {
auto input = Tensor(Array1D<float, 3>({0,0,0}));
auto expectedOutput = Tensor(Array2D<float, 3, 3>({{{0,0,0}, {0,0,0}, {0,0,0}}}));
auto spikes = spikegenRate(std::make_shared<Tensor>(input), 3);
approxEq<float>(spikes, expectedOutput);
}
TEST_CASE("[core/data] SpikeGen ones", "[SpikeGen]") {
auto input = Tensor(Array1D<float, 3>({1,1,1}));
auto expectedOutput = Tensor(Array2D<float, 3, 3>({{{1,1,1}, {1,1,1}, {1,1,1}}}));
auto spikes = spikegenRate(std::make_shared<Tensor>(input), 3);
approxEq<float>(spikes, expectedOutput);
}
} // namespace Aidge
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