diff --git a/unit_tests/operator/Test_ScalingMeta.cpp b/unit_tests/operator/Test_ScalingMeta.cpp new file mode 100644 index 0000000000000000000000000000000000000000..592531b81b9ac133445a1a4f0bafc283a24a59c8 --- /dev/null +++ b/unit_tests/operator/Test_ScalingMeta.cpp @@ -0,0 +1,83 @@ +/******************************************************************************** + * Copyright (c) 2023 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 <catch2/catch_test_macros.hpp> +#include <cmath> +#include <cstdlib> +#include <memory> + +#include "aidge/utils/TensorUtils.hpp" +#include "aidge/backend/cpu/operator/ConvImpl.hpp" +#include "aidge/backend/cpu/operator/PadImpl.hpp" +#include "aidge/data/Tensor.hpp" +#include "aidge/operator/Conv.hpp" +#include "aidge/operator/MetaOperator.hpp" +#include "aidge/operator/MetaOperatorDefs.hpp" +#include "aidge/operator/Pad.hpp" +#include "aidge/operator/Pop.hpp" +#include "aidge/scheduler/SequentialScheduler.hpp" +#include "aidge/scheduler/ParallelScheduler.hpp" + +using namespace Aidge; + +TEST_CASE("ScalingNodeMeta", "[ScalingMeta][CPU]") { + /*SECTION("Scaling MetaOperator") + { + std::shared_ptr<Tensor> t0 = std::make_shared<Tensor>( + Array2D<float, 3, 3>{{{45, 72, 2}, + {84.15, 144.45, 0.01484}, + {0.62132, 17.67132, 212.132}}}); + + auto scal = ScalingMeta(2,8,false); + auto scalop = std::static_pointer_cast<OperatorTensor>(scal->getOperator()); + t0->setBackend("cpu"); + scalop->associateInput(0,t0); + scalop->setBackend("cpu"); + scalop->forwardDims(); + scalop->forward(); + //auto sf = scalop -> getInput(1); + auto out0 = scalop->getOutput(0); + auto in0 = scalop->getInput(0); + auto in1 = scalop->getInput(1); + std::cout << "in0 is: "; + in0->print(); + std::cout << "in1 is: "; + in1->print(); + std::cout << "output is: " ; + out0->print(); + }*/ + SECTION("MulPTQ") + { + std::shared_ptr<Tensor> t0 = std::make_shared<Tensor>( + Array2D<float, 3, 3>{{{45, 72, 2}, + {84.15, 144.45, 0.01484}, + {0.62132, 17.67132, 212.132}}}); + + auto scal = MulPTQ(2.001); + auto scalop = std::static_pointer_cast<OperatorTensor>(scal->getOperator()); + + t0->setBackend("cpu"); + scalop->associateInput(0,t0); + scalop->setBackend("cpu"); + scalop->forwardDims(); + //scalop->forward(); + scal->forward(); + auto out0 = scalop->getOutput(0); + auto in0 = scalop->getInput(0); + auto in1 = scalop->getInput(1); + std::cout << "in0 is: "; + in0->print(); + std::cout << "in1 is: "; + in1->print(); + std::cout << "output is: " ; + out0->print(); + } +} \ No newline at end of file