ATLAS Offline Software
Loading...
Searching...
No Matches
MuonML::InferenceUtils Namespace Reference

Classes

struct  SessionBackend

Functions

template<class SessionToolHandle>
SessionBackend sessionBackend (const SessionToolHandle &sessionTool)
float sigmoid (float x)

Function Documentation

◆ sessionBackend()

template<class SessionToolHandle>
SessionBackend MuonML::InferenceUtils::sessionBackend ( const SessionToolHandle & sessionTool)

Definition at line 19 of file InferenceUtils.h.

19 {
20 if (const auto* cudaTool = dynamic_cast<const AthOnnx::OnnxRuntimeSessionToolCUDA*>(sessionTool.get())) {
21 return SessionBackend{true, cudaTool->deviceId()};
22 }
23 return SessionBackend{};
24}

◆ sigmoid()

float MuonML::InferenceUtils::sigmoid ( float x)
inline

Definition at line 26 of file InferenceUtils.h.

26 {
27 if (x >= 0.f) {
28 const float z = std::exp(-x);
29 return 1.f / (1.f + z);
30 }
31 const float z = std::exp(x);
32 return z / (1.f + z);
33}
#define x
#define z