GeNN  4.9.0
GPU enhanced Neuronal Networks (GeNN)
InitToeplitzConnectivitySnippet::Conv2D Class Reference

#include <initToeplitzConnectivitySnippet.h>

Inheritance diagram for InitToeplitzConnectivitySnippet::Conv2D:
InitToeplitzConnectivitySnippet::Base Snippet::Base

Public Member Functions

 DECLARE_SNIPPET (Conv2D, 8)
 
virtual StringVec getParamNames () const override
 Gets names of of (independent) model parameters. More...
 
virtual DerivedParamVec getDerivedParams () const override
 
 SET_DIAGONAL_BUILD_STATE_VARS ({{"kernRow", "int", "($(id_diag) / (int)$(conv_oc)) / (int)$(conv_kw)"}, {"kernCol", "int", "($(id_diag) / (int)$(conv_oc)) % (int)$(conv_kw)"}, {"kernOutChan", "int", "$(id_diag) % (int)$(conv_oc)"}, {"flipKernRow", "int", "(int)$(conv_kh) - $(kernRow) - 1"}, {"flipKernCol", "int", "(int)$(conv_kw) - $(kernCol) - 1"}})
 
 SET_DIAGONAL_BUILD_CODE ("const int preRow = ($(id_pre) / (int)$(conv_ic)) / (int)$(conv_iw);\ "const int preCol=($(id_pre)/(int)$(conv_ic)) %(int)$(conv_iw);\" "const int preChan=$(id_pre) %(int)$(conv_ic);\" "//If we haven 't gone off edge of output\" "const int postRow=preRow+$(kernRow) -(int)$(conv_bh);\" "const int postCol=preCol+$(kernCol) -(int)$(conv_bw);\" "if(postRow >=0 &&postCol >=0 &&postRow<(int)$(conv_oh) &&postCol<(int)$(conv_ow)) {\" "//Calculate postsynaptic index\" " const int postInd=((postRow *(int)$(conv_ow) *(int)$(conv_oc))+\" "(postCol *(int)$(conv_oc))+\" " $(kernOutChan));\" " $(addSynapse, postInd, $(flipKernRow), $(flipKernCol), preChan, $(kernOutChan));\" "}\")
 
 SET_CALC_MAX_ROW_LENGTH_FUNC ([](unsigned int, unsigned int, const std::vector< double > &pars) { const unsigned int convKH=(unsigned int) pars[0];const unsigned int convKW=(unsigned int) pars[1];const unsigned int convOC=(unsigned int) pars[7];return(convKH *convKW *convOC);})
 
 SET_CALC_KERNEL_SIZE_FUNC ([](const std::vector< double > &pars) ->std::vector< unsigned int > { const unsigned int convKH=(unsigned int) pars[0];const unsigned int convKW=(unsigned int) pars[1];const unsigned int convIC=(unsigned int) pars[4];const unsigned int convOC=(unsigned int) pars[7];return {convKH, convKW, convIC, convOC};})
 
- Public Member Functions inherited from InitToeplitzConnectivitySnippet::Base
virtual std::string getDiagonalBuildCode () const
 
virtual ParamValVec getDiagonalBuildStateVars () const
 
virtual CalcMaxLengthFunc getCalcMaxRowLengthFunc () const
 Get function to calculate the maximum row length of this connector based on the parameters and the size of the pre and postsynaptic population. More...
 
virtual CalcKernelSizeFunc getCalcKernelSizeFunc () const
 Get function to calculate kernel size required for this conenctor based on its parameters. More...
 
boost::uuids::detail::sha1::digest_type getHashDigest () const
 Update hash from snippet. More...
 
void validate () const
 Validate names of parameters etc. More...
 
- Public Member Functions inherited from Snippet::Base
virtual ~Base ()
 
virtual EGPVec getExtraGlobalParams () const
 
size_t getExtraGlobalParamIndex (const std::string &paramName) const
 Find the index of a named extra global parameter. More...
 

Additional Inherited Members

- Public Types inherited from InitToeplitzConnectivitySnippet::Base
typedef std::function< unsigned int(unsigned int, unsigned int, const std::vector< double > &)> CalcMaxLengthFunc
 
typedef std::function< std::vector< unsigned int >const std::vector< double > &)> CalcKernelSizeFunc
 
- Public Types inherited from Snippet::Base
typedef std::vector< std::string > StringVec
 
typedef std::vector< EGPEGPVec
 
typedef std::vector< ParamValParamValVec
 
typedef std::vector< DerivedParamDerivedParamVec
 
- Protected Member Functions inherited from Snippet::Base
void updateHash (boost::uuids::detail::sha1 &hash) const
 
void validate () const
 Validate names of parameters etc. More...
 
- Static Protected Member Functions inherited from Snippet::Base
template<typename T >
static size_t getNamedVecIndex (const std::string &name, const std::vector< T > &vec)
 

Detailed Description

Initialises convolutional connectivity Row build state variables are used to convert presynaptic neuron index to rows, columns and channels and, from these, to calculate the range of postsynaptic rows, columns and channels connections will be made within.

Member Function Documentation

◆ DECLARE_SNIPPET()

InitToeplitzConnectivitySnippet::Conv2D::DECLARE_SNIPPET ( Conv2D  ,
 
)

◆ getDerivedParams()

virtual DerivedParamVec InitToeplitzConnectivitySnippet::Conv2D::getDerivedParams ( ) const
inlineoverridevirtual

Gets names of derived model parameters and the function objects to call to Calculate their value from a vector of model parameter values

Reimplemented from Snippet::Base.

◆ getParamNames()

virtual StringVec InitToeplitzConnectivitySnippet::Conv2D::getParamNames ( ) const
inlineoverridevirtual

Gets names of of (independent) model parameters.

Reimplemented from Snippet::Base.

◆ SET_CALC_KERNEL_SIZE_FUNC()

InitToeplitzConnectivitySnippet::Conv2D::SET_CALC_KERNEL_SIZE_FUNC ( [] (const std::vector< double > &pars) ->std::vector< unsigned int > { const unsigned int convKH=(unsigned int) pars[0];const unsigned int convKW=(unsigned int) pars[1];const unsigned int convIC=(unsigned int) pars[4];const unsigned int convOC=(unsigned int) pars[7];return {convKH, convKW, convIC, convOC};}  )

◆ SET_CALC_MAX_ROW_LENGTH_FUNC()

InitToeplitzConnectivitySnippet::Conv2D::SET_CALC_MAX_ROW_LENGTH_FUNC ( [] (unsigned int, unsigned int, const std::vector< double > &pars) { const unsigned int convKH=(unsigned int) pars[0];const unsigned int convKW=(unsigned int) pars[1];const unsigned int convOC=(unsigned int) pars[7];return(convKH *convKW *convOC);}  )

◆ SET_DIAGONAL_BUILD_CODE()

InitToeplitzConnectivitySnippet::Conv2D::SET_DIAGONAL_BUILD_CODE ( )

◆ SET_DIAGONAL_BUILD_STATE_VARS()

InitToeplitzConnectivitySnippet::Conv2D::SET_DIAGONAL_BUILD_STATE_VARS ( {{"kernRow", "int", "($(id_diag) / (int)$(conv_oc)) / (int)$(conv_kw)"}, {"kernCol", "int", "($(id_diag) / (int)$(conv_oc)) % (int)$(conv_kw)"}, {"kernOutChan", "int", "$(id_diag) % (int)$(conv_oc)"}, {"flipKernRow", "int", "(int)$(conv_kh) - $(kernRow) - 1"}, {"flipKernCol", "int", "(int)$(conv_kw) - $(kernCol) - 1"}}  )

The documentation for this class was generated from the following file: