|
BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
|
#include <BmnGemStripMLPModel.h>
Public Types | |
| enum | OutputActivation { kLinearOutput = 0 , kSigmoidOutput = 1 , kLinearOutput = 0 , kSigmoidOutput = 1 } |
| enum | OutputActivation { kLinearOutput = 0 , kSigmoidOutput = 1 , kLinearOutput = 0 , kSigmoidOutput = 1 } |
Public Member Functions | |
| BmnGemStripMLPModel () | |
| BmnGemStripMLPModel (const std::string &path, bool verbose=true) | |
| virtual | ~BmnGemStripMLPModel () |
| bool | Load (const std::string &path, bool verbose=true) |
| void | Clear () |
| bool | IsLoaded () const |
| int | GetInputDim () const |
| int | GetWidth () const |
| int | GetNBlocks () const |
| int | GetOutputDim () const |
| int | GetOutputActivation () const |
| float | GetLayerNormEpsilon () const |
| float | GetLeakyReLUSlope () const |
| size_t | GetNParams () const |
| const std::vector< std::string > & | GetFeatureNames () const |
| int | GetFeatureIndex (const std::string &name) const |
| bool | CheckFeatureNames (const std::vector< std::string > &expected, std::string *why=nullptr) const |
| const std::string & | GetFilePath () const |
| const std::string & | GetArchHash () const |
| const std::string & | GetSourceName () const |
| const std::string & | GetCreated () const |
| void | Print (std::ostream &os=std::cout) const |
| bool | Predict (const float *input, float *output) const |
| std::vector< float > | Predict (const std::vector< float > &input) const |
| bool | PredictSplit (const float *common, int n_common, const float *specific, int n_rows, float *output) const |
| int | GetNTests () const |
| float | GetTestTolerance () const |
| bool | RunSelfTest (float *max_abs_diff=nullptr, bool verbose=false) const |
| const float * | GetTestInput (int itest) const |
| const float * | GetTestOutput (int itest) const |
| BmnGemStripMLPModel () | |
| BmnGemStripMLPModel (const std::string &path, bool verbose=true) | |
| virtual | ~BmnGemStripMLPModel () |
| bool | Load (const std::string &path, bool verbose=true) |
| void | Clear () |
| bool | IsLoaded () const |
| int | GetInputDim () const |
| int | GetWidth () const |
| int | GetNBlocks () const |
| int | GetOutputDim () const |
| int | GetOutputActivation () const |
| float | GetLayerNormEpsilon () const |
| float | GetLeakyReLUSlope () const |
| size_t | GetNParams () const |
| const std::vector< std::string > & | GetFeatureNames () const |
| int | GetFeatureIndex (const std::string &name) const |
| bool | CheckFeatureNames (const std::vector< std::string > &expected, std::string *why=nullptr) const |
| const std::string & | GetFilePath () const |
| const std::string & | GetArchHash () const |
| const std::string & | GetSourceName () const |
| const std::string & | GetCreated () const |
| void | Print (std::ostream &os=std::cout) const |
| bool | Predict (const float *input, float *output) const |
| std::vector< float > | Predict (const std::vector< float > &input) const |
| bool | PredictSplit (const float *common, int n_common, const float *specific, int n_rows, float *output) const |
| int | GetNTests () const |
| float | GetTestTolerance () const |
| bool | RunSelfTest (float *max_abs_diff=nullptr, bool verbose=false) const |
| const float * | GetTestInput (int itest) const |
| const float * | GetTestOutput (int itest) const |
Static Public Member Functions | |
| static std::shared_ptr< const BmnGemStripMLPModel > | GetShared (const std::string &path="") |
| static void | SetDefaultPath (const std::string &path) |
| static std::string | GetDefaultPath () |
| static std::string | GetBuiltinDefaultPath () |
| static void | ClearSharedCache () |
| static std::shared_ptr< const BmnGemStripMLPModel > | GetShared (const std::string &path="") |
| static void | SetDefaultPath (const std::string &path) |
| static std::string | GetDefaultPath () |
| static std::string | GetBuiltinDefaultPath () |
| static void | ClearSharedCache () |
Static Public Attributes | |
| static constexpr int | kMaxWidth = 1024 |
| static constexpr int | kMaxDim = 1024 |
Private Member Functions | |
| void | ForwardFromFirstDense (float *h, float *output) const |
| bool | Parse (const std::vector< unsigned char > &buffer, std::string &error) |
| void | ForwardFromFirstDense (float *h, float *output) const |
| bool | Parse (const std::vector< unsigned char > &buffer, std::string &error) |
Private Attributes | |
| bool | fLoaded |
| int | fInputDim |
| int | fWidth |
| int | fNBlocks |
| int | fOutputDim |
| int | fOutputActivation |
| float | fLayerNormEps |
| float | fLeakyReLUSlope |
| std::string | fFilePath |
| std::string | fArchHash |
| std::string | fSourceName |
| std::string | fCreated |
| std::vector< std::string > | fFeatureNames |
| std::vector< float > | fParams |
| size_t | fOffDenseInW |
| size_t | fOffDenseInB |
| size_t | fOffBlocks |
| size_t | fBlockSize |
| size_t | fOffFinalLnG |
| size_t | fOffFinalLnB |
| size_t | fOffDenseOutW |
| size_t | fOffDenseOutB |
| int | fNTests |
| float | fTestTolerance |
| std::vector< float > | fTestInputs |
| std::vector< float > | fTestOutputs |
Definition at line 34 of file BmnGemStripMLPModel.h.
| Enumerator | ||
|---|---|---|
| kLinearOutput | 0 | |
| kSigmoidOutput | 1 | |
| kLinearOutput | 0 | |
| kSigmoidOutput | 1 | |
Definition at line 43 of file BmnGemStripMLPModel.h.
| Enumerator | ||
|---|---|---|
| kLinearOutput | 0 | |
| kSigmoidOutput | 1 | |
| kLinearOutput | 0 | |
| kSigmoidOutput | 1 | |
Definition at line 43 of file BmnGemStripMLPModel.h.
| BmnGemStripMLPModel::BmnGemStripMLPModel | ( | ) |
Definition at line 282 of file BmnGemStripMLPModel.cxx.
References Clear().
|
explicit |
Definition at line 287 of file BmnGemStripMLPModel.cxx.
References Clear(), and Load().
|
virtual |
Definition at line 293 of file BmnGemStripMLPModel.cxx.
| BmnGemStripMLPModel::BmnGemStripMLPModel | ( | ) |
|
explicit |
|
virtual |
| bool BmnGemStripMLPModel::CheckFeatureNames | ( | const std::vector< std::string > & | expected, |
| std::string * | why = nullptr ) const |
Definition at line 665 of file BmnGemStripMLPModel.cxx.
References fFeatureNames, and i.
Referenced by BmnGemStripModule::AddRealPointFull_ANNStripGenerator_MLP(), BmnGemStripModule::AddRealPointFull_ANNStripGenerator_MLP_FastStand(), and BmnGemStripModule::AddRealPointFull_ANNStripGenerator_MLP_Parallel().
| bool BmnGemStripMLPModel::CheckFeatureNames | ( | const std::vector< std::string > & | expected, |
| std::string * | why = nullptr ) const |
| void BmnGemStripMLPModel::Clear | ( | ) |
Definition at line 295 of file BmnGemStripMLPModel.cxx.
References fArchHash, fBlockSize, fCreated, fFeatureNames, fFilePath, fInputDim, fLayerNormEps, fLeakyReLUSlope, fLoaded, fNBlocks, fNTests, fOffBlocks, fOffDenseInB, fOffDenseInW, fOffDenseOutB, fOffDenseOutW, fOffFinalLnB, fOffFinalLnG, fOutputActivation, fOutputDim, fParams, fSourceName, fTestInputs, fTestOutputs, fTestTolerance, fWidth, and kLinearOutput.
Referenced by BmnGemStripMLPModel(), BmnGemStripMLPModel(), and Load().
| void BmnGemStripMLPModel::Clear | ( | ) |
|
static |
Definition at line 754 of file BmnGemStripMLPModel.cxx.
|
static |
|
private |
Definition at line 513 of file BmnGemStripMLPModel.cxx.
References fBlockSize, fLayerNormEps, fLeakyReLUSlope, fNBlocks, fOffBlocks, fOffDenseOutB, fOffDenseOutW, fOffFinalLnB, fOffFinalLnG, fOutputActivation, fOutputDim, fParams, fWidth, i, kMaxWidth, and kSigmoidOutput.
Referenced by Predict(), and PredictSplit().
|
private |
|
inline |
Definition at line 81 of file BmnGemStripMLPModel.h.
References fArchHash.
|
inline |
Definition at line 81 of file BmnGemStripMLPModel.h.
References fArchHash.
|
static |
Definition at line 749 of file BmnGemStripMLPModel.cxx.
|
static |
|
inline |
Definition at line 83 of file BmnGemStripMLPModel.h.
References fCreated.
|
inline |
Definition at line 83 of file BmnGemStripMLPModel.h.
References fCreated.
|
static |
Definition at line 742 of file BmnGemStripMLPModel.cxx.
Referenced by BmnGemStripModule::GetANNModelPath().
|
static |
| int BmnGemStripMLPModel::GetFeatureIndex | ( | const std::string & | name | ) | const |
Definition at line 659 of file BmnGemStripMLPModel.cxx.
References fFeatureNames.
| int BmnGemStripMLPModel::GetFeatureIndex | ( | const std::string & | name | ) | const |
|
inline |
Definition at line 75 of file BmnGemStripMLPModel.h.
References fFeatureNames.
|
inline |
Definition at line 75 of file BmnGemStripMLPModel.h.
References fFeatureNames.
|
inline |
Definition at line 80 of file BmnGemStripMLPModel.h.
References fFilePath.
Referenced by BmnGemStripModule::AddRealPointFull_ANNStripGenerator_MLP(), BmnGemStripModule::AddRealPointFull_ANNStripGenerator_MLP_FastStand(), and BmnGemStripModule::AddRealPointFull_ANNStripGenerator_MLP_Parallel().
|
inline |
Definition at line 80 of file BmnGemStripMLPModel.h.
References fFilePath.
|
inline |
Definition at line 66 of file BmnGemStripMLPModel.h.
References fInputDim.
|
inline |
Definition at line 66 of file BmnGemStripMLPModel.h.
References fInputDim.
|
inline |
Definition at line 71 of file BmnGemStripMLPModel.h.
References fLayerNormEps.
|
inline |
Definition at line 71 of file BmnGemStripMLPModel.h.
References fLayerNormEps.
|
inline |
Definition at line 72 of file BmnGemStripMLPModel.h.
References fLeakyReLUSlope.
|
inline |
Definition at line 72 of file BmnGemStripMLPModel.h.
References fLeakyReLUSlope.
|
inline |
Definition at line 68 of file BmnGemStripMLPModel.h.
References fNBlocks.
|
inline |
Definition at line 68 of file BmnGemStripMLPModel.h.
References fNBlocks.
|
inline |
Definition at line 73 of file BmnGemStripMLPModel.h.
References fParams.
|
inline |
Definition at line 73 of file BmnGemStripMLPModel.h.
References fParams.
|
inline |
Definition at line 102 of file BmnGemStripMLPModel.h.
References fNTests.
|
inline |
Definition at line 102 of file BmnGemStripMLPModel.h.
References fNTests.
|
inline |
Definition at line 70 of file BmnGemStripMLPModel.h.
References fOutputActivation.
|
inline |
Definition at line 70 of file BmnGemStripMLPModel.h.
References fOutputActivation.
|
inline |
Definition at line 69 of file BmnGemStripMLPModel.h.
References fOutputDim.
Referenced by BmnGemStripModule::AddRealPointFull_ANNStripGenerator_MLP(), BmnGemStripModule::AddRealPointFull_ANNStripGenerator_MLP_FastStand(), and BmnGemStripModule::AddRealPointFull_ANNStripGenerator_MLP_Parallel().
|
inline |
Definition at line 69 of file BmnGemStripMLPModel.h.
References fOutputDim.
|
static |
Definition at line 704 of file BmnGemStripMLPModel.cxx.
Referenced by BmnGemStripModule::AddRealPointFull_ANNStripGenerator_MLP(), BmnGemStripModule::AddRealPointFull_ANNStripGenerator_MLP_FastStand(), and BmnGemStripModule::AddRealPointFull_ANNStripGenerator_MLP_Parallel().
|
static |
|
inline |
Definition at line 82 of file BmnGemStripMLPModel.h.
References fSourceName.
|
inline |
Definition at line 82 of file BmnGemStripMLPModel.h.
References fSourceName.
| const float * BmnGemStripMLPModel::GetTestInput | ( | int | itest | ) | const |
Definition at line 616 of file BmnGemStripMLPModel.cxx.
References fInputDim, fNTests, and fTestInputs.
Referenced by RunSelfTest().
| const float * BmnGemStripMLPModel::GetTestInput | ( | int | itest | ) | const |
| const float * BmnGemStripMLPModel::GetTestOutput | ( | int | itest | ) | const |
Definition at line 623 of file BmnGemStripMLPModel.cxx.
References fNTests, fOutputDim, and fTestOutputs.
Referenced by RunSelfTest().
| const float * BmnGemStripMLPModel::GetTestOutput | ( | int | itest | ) | const |
|
inline |
Definition at line 103 of file BmnGemStripMLPModel.h.
References fTestTolerance.
|
inline |
Definition at line 103 of file BmnGemStripMLPModel.h.
References fTestTolerance.
|
inline |
Definition at line 67 of file BmnGemStripMLPModel.h.
References fWidth.
|
inline |
Definition at line 67 of file BmnGemStripMLPModel.h.
References fWidth.
|
inline |
Definition at line 62 of file BmnGemStripMLPModel.h.
References fLoaded.
|
inline |
Definition at line 62 of file BmnGemStripMLPModel.h.
References fLoaded.
| bool BmnGemStripMLPModel::Load | ( | const std::string & | path, |
| bool | verbose = true ) |
Definition at line 324 of file BmnGemStripMLPModel.cxx.
References Clear(), fFilePath, fLoaded, fTestTolerance, Parse(), and RunSelfTest().
Referenced by BmnGemStripMLPModel().
| bool BmnGemStripMLPModel::Load | ( | const std::string & | path, |
| bool | verbose = true ) |
|
private |
Definition at line 376 of file BmnGemStripMLPModel.cxx.
References fArchHash, fBlockSize, fCreated, fFeatureNames, fInputDim, fLayerNormEps, fLeakyReLUSlope, fNBlocks, fNTests, fOffBlocks, fOffDenseInB, fOffDenseInW, fOffDenseOutB, fOffDenseOutW, fOffFinalLnB, fOffFinalLnG, fOutputActivation, fOutputDim, fParams, fSourceName, fTestInputs, fTestOutputs, fTestTolerance, fWidth, kLinearOutput, kMaxDim, kMaxWidth, kSigmoidOutput, names, and v.
Referenced by Load().
|
private |
References fArchHash, fBlockSize, fCreated, fFeatureNames, fFilePath, fInputDim, fLayerNormEps, fLeakyReLUSlope, fLoaded, fNBlocks, fNTests, fOffBlocks, fOffDenseInB, fOffDenseInW, fOffDenseOutB, fOffDenseOutW, fOffFinalLnB, fOffFinalLnG, fOutputActivation, fOutputDim, fParams, fSourceName, fTestInputs, fTestOutputs, fTestTolerance, and fWidth.
| bool BmnGemStripMLPModel::Predict | ( | const float * | input, |
| float * | output ) const |
Definition at line 551 of file BmnGemStripMLPModel.cxx.
References fInputDim, fLoaded, fOffDenseInB, fOffDenseInW, ForwardFromFirstDense(), fParams, fWidth, kMaxDim, and kMaxWidth.
Referenced by Predict(), and RunSelfTest().
| bool BmnGemStripMLPModel::Predict | ( | const float * | input, |
| float * | output ) const |
| std::vector< float > BmnGemStripMLPModel::Predict | ( | const std::vector< float > & | input | ) | const |
Definition at line 570 of file BmnGemStripMLPModel.cxx.
References fInputDim, fLoaded, fOutputDim, and Predict().
| std::vector< float > BmnGemStripMLPModel::Predict | ( | const std::vector< float > & | input | ) | const |
| bool BmnGemStripMLPModel::PredictSplit | ( | const float * | common, |
| int | n_common, | ||
| const float * | specific, | ||
| int | n_rows, | ||
| float * | output ) const |
Definition at line 581 of file BmnGemStripMLPModel.cxx.
References fInputDim, fLoaded, fOffDenseInB, fOffDenseInW, ForwardFromFirstDense(), fOutputDim, fParams, fWidth, kMaxDim, kMaxWidth, and W().
Referenced by BmnGemStripModule::AddRealPointFull_ANNStripGenerator_MLP(), BmnGemStripModule::AddRealPointFull_ANNStripGenerator_MLP_FastStand(), and BmnGemStripModule::AddRealPointFull_ANNStripGenerator_MLP_Parallel().
| bool BmnGemStripMLPModel::PredictSplit | ( | const float * | common, |
| int | n_common, | ||
| const float * | specific, | ||
| int | n_rows, | ||
| float * | output ) const |
| void BmnGemStripMLPModel::Print | ( | std::ostream & | os = std::cout | ) | const |
Definition at line 684 of file BmnGemStripMLPModel.cxx.
References fArchHash, fCreated, fFeatureNames, fFilePath, fInputDim, fLayerNormEps, fLeakyReLUSlope, fLoaded, fNBlocks, fNTests, fOutputActivation, fOutputDim, fParams, fSourceName, fTestTolerance, fWidth, i, and kSigmoidOutput.
| void BmnGemStripMLPModel::Print | ( | std::ostream & | os = std::cout | ) | const |
| bool BmnGemStripMLPModel::RunSelfTest | ( | float * | max_abs_diff = nullptr, |
| bool | verbose = false ) const |
Definition at line 630 of file BmnGemStripMLPModel.cxx.
References d, fLoaded, fNTests, fOutputDim, fTestTolerance, GetTestInput(), GetTestOutput(), and Predict().
Referenced by Load().
| bool BmnGemStripMLPModel::RunSelfTest | ( | float * | max_abs_diff = nullptr, |
| bool | verbose = false ) const |
|
static |
Definition at line 735 of file BmnGemStripMLPModel.cxx.
Referenced by BmnGemStripModule::SetANNModelPath().
|
static |
|
private |
Definition at line 139 of file BmnGemStripMLPModel.h.
Referenced by Clear(), GetArchHash(), Parse(), and Print().
|
private |
Definition at line 149 of file BmnGemStripMLPModel.h.
Referenced by Clear(), ForwardFromFirstDense(), and Parse().
|
private |
Definition at line 141 of file BmnGemStripMLPModel.h.
Referenced by Clear(), GetCreated(), Parse(), and Print().
|
private |
Definition at line 142 of file BmnGemStripMLPModel.h.
Referenced by CheckFeatureNames(), Clear(), GetFeatureIndex(), GetFeatureNames(), Parse(), and Print().
|
private |
Definition at line 138 of file BmnGemStripMLPModel.h.
Referenced by Clear(), GetFilePath(), Load(), Parse(), and Print().
|
private |
Definition at line 130 of file BmnGemStripMLPModel.h.
Referenced by Clear(), GetInputDim(), GetTestInput(), Parse(), Predict(), Predict(), PredictSplit(), and Print().
|
private |
Definition at line 135 of file BmnGemStripMLPModel.h.
Referenced by Clear(), ForwardFromFirstDense(), GetLayerNormEpsilon(), Parse(), and Print().
|
private |
Definition at line 136 of file BmnGemStripMLPModel.h.
Referenced by Clear(), ForwardFromFirstDense(), GetLeakyReLUSlope(), Parse(), and Print().
|
private |
Definition at line 128 of file BmnGemStripMLPModel.h.
Referenced by Clear(), IsLoaded(), Load(), Parse(), Predict(), Predict(), PredictSplit(), Print(), and RunSelfTest().
|
private |
Definition at line 132 of file BmnGemStripMLPModel.h.
Referenced by Clear(), ForwardFromFirstDense(), GetNBlocks(), Parse(), and Print().
|
private |
Definition at line 156 of file BmnGemStripMLPModel.h.
Referenced by Clear(), GetNTests(), GetTestInput(), GetTestOutput(), Parse(), Print(), and RunSelfTest().
|
private |
Definition at line 148 of file BmnGemStripMLPModel.h.
Referenced by Clear(), ForwardFromFirstDense(), and Parse().
|
private |
Definition at line 147 of file BmnGemStripMLPModel.h.
Referenced by Clear(), Parse(), Predict(), and PredictSplit().
|
private |
Definition at line 146 of file BmnGemStripMLPModel.h.
Referenced by Clear(), Parse(), Predict(), and PredictSplit().
|
private |
Definition at line 153 of file BmnGemStripMLPModel.h.
Referenced by Clear(), ForwardFromFirstDense(), and Parse().
|
private |
Definition at line 152 of file BmnGemStripMLPModel.h.
Referenced by Clear(), ForwardFromFirstDense(), and Parse().
|
private |
Definition at line 151 of file BmnGemStripMLPModel.h.
Referenced by Clear(), ForwardFromFirstDense(), and Parse().
|
private |
Definition at line 150 of file BmnGemStripMLPModel.h.
Referenced by Clear(), ForwardFromFirstDense(), and Parse().
|
private |
Definition at line 134 of file BmnGemStripMLPModel.h.
Referenced by Clear(), ForwardFromFirstDense(), GetOutputActivation(), Parse(), and Print().
|
private |
Definition at line 133 of file BmnGemStripMLPModel.h.
Referenced by Clear(), ForwardFromFirstDense(), GetOutputDim(), GetTestOutput(), Parse(), Predict(), PredictSplit(), Print(), and RunSelfTest().
|
private |
Definition at line 145 of file BmnGemStripMLPModel.h.
Referenced by Clear(), ForwardFromFirstDense(), GetNParams(), Parse(), Predict(), PredictSplit(), and Print().
|
private |
Definition at line 140 of file BmnGemStripMLPModel.h.
Referenced by Clear(), GetSourceName(), Parse(), and Print().
|
private |
Definition at line 158 of file BmnGemStripMLPModel.h.
Referenced by Clear(), GetTestInput(), and Parse().
|
private |
Definition at line 159 of file BmnGemStripMLPModel.h.
Referenced by Clear(), GetTestOutput(), and Parse().
|
private |
Definition at line 157 of file BmnGemStripMLPModel.h.
Referenced by Clear(), GetTestTolerance(), Load(), Parse(), Print(), and RunSelfTest().
|
private |
Definition at line 131 of file BmnGemStripMLPModel.h.
Referenced by Clear(), ForwardFromFirstDense(), GetWidth(), Parse(), Predict(), PredictSplit(), and Print().
|
staticconstexpr |
Definition at line 40 of file BmnGemStripMLPModel.h.
Referenced by Parse(), Predict(), and PredictSplit().
|
staticconstexpr |
Definition at line 39 of file BmnGemStripMLPModel.h.
Referenced by ForwardFromFirstDense(), Parse(), Predict(), and PredictSplit().