Skip to content
Snippets Groups Projects

[Add] Dropout Operator

Merged Marwa ABDELOUINISSE requested to merge maab05/aidge_backend_cpu:feat_183_add_dropout into dev

Context

Update the cpu.hpp file and add the following new files for the dropout implementation based on the Bernoulli distribution:

  • DropoutImp_forward_kernels.hpp
  • DropoutImp.hpp
  • DropoutImpl.cpp

Part of: aidge_core#183

Modified files

  • aidge/aidge_backend_cpu/include/aidge/backend/cpu.hpp

Added files

  • aidge_backend_cpu/include/aidge/backend/cpu/operator/DropoutImpl_forward_kernels.hpp
  • aidge_backend_cpu/include/aidge/backend/cpu/operator/DropoutImpl.hpp
  • aidge_backend_cpu/src/operator/DropoutImpl.cpp
  • add: unit-test Test_DropoutImpl.cpp
Edited by Maxence Naud

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • 14 #include <numeric>
    15 #include <thread>
    16 #include <vector>
    17
    18 #include "aidge/operator/Dropout.hpp"
    19 #include "aidge/utils/Types.h"
    20 #include "aidge/data/Tensor.hpp"
    21
    22 #include "aidge/backend/cpu/operator/DropoutImpl.hpp"
    23 #include "aidge/backend/cpu/operator/DropoutImpl_forward_kernels.hpp"
    24
    25 void Aidge::DropoutImpl_cpu::forward() {
    26 // Safely cast mOp to Dropout_Op and handle any error if the cast fails
    27 const Dropout_Op* op_ = dynamic_cast<const Dropout_Op*>(&mOp);
    28 if (!op_) {
    29 throw std::runtime_error("DropoutImpl_cpu::forward: mOp is not of type Dropout_Op");
  • 44 op_->getInput(0)->dataType(),
    45 op_->getOutput(0)->dataType()});
    46
    47 // Check if kernel function was successfully created
    48 if (!kernelFunc) {
    49 throw std::runtime_error("DropoutImpl_cpu::forward: Failed to create kernel function");
    50 }
    51
    52 // // Call Kernel
    53 // kernelFunc(dynamic_cast<const Dropout_Op&>(mOp).getStaticAttributes(),
    54 // op_->getInput(0)->dims(), // Input tensor dimensions
    55 // op_->getInput(0)->getImpl()->rawPtr(), // Raw pointer to input data
    56 // op_->getOutput(0)->getImpl()->rawPtr()); // Raw pointer to output data
    57
    58 // Call the forward kernel function
    59 kernelFunc(
  • Marwa ABDELOUINISSE changed the description

    changed the description

  • Cyril Moineau mentioned in merge request aidge!73

    mentioned in merge request aidge!73

  • Maxence Naud marked this merge request as draft

    marked this merge request as draft

  • added 1 commit

    • 483c8bb1 - Apply 1 suggestion(s) to 1 file(s)

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 83 commits

    • cfd6fba9...ed718fc0 - 81 commits from branch eclipse/aidge:dev
    • 740a27ba - Merge branch 'dev' into 'main'
    • 788a5e7b - Merge branch aidge_backend_cpu:main into feat_183_add_dropout

    Compare with previous version

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading