#include "eval_relu.h"

eval_relu::eval_relu(const expression &expr): eval_op(expr) {
}

void eval_relu::eval(vars_type &variables, const kwargs_type &kwargs) {
   // Check that inputs_ is not empty
   assert(!inputs_.empty());

   // Retrieve the tensor from variables using the first input expression ID
   const int inputExprId = inputs_[0];
   tensor t = variables.at(inputExprId);

   // For debugging: print the input tensor
   std::cout << "Input Tensor for ReLU (expr_id " << inputExprId << "):" << std::endl;
   //t.print();

   // Perform the ReLU operation
   tensor reluResult = ReLU(t);

   // Store the result in variables under the key expr_id_
   variables[expr_id_] = reluResult;
}

std::shared_ptr<eval_op> eval_relu::clone(const expression &expr) {
    return std::make_shared<eval_relu>(expr);
}