Analysis Software
Documentation for
sPHENIX
simulation software
Home page
Related Pages
Modules
Namespaces
Classes
Files
Examples
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
TorchMetricLearning.hpp
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file TorchMetricLearning.hpp
1
// This file is part of the Acts project.
2
//
3
// Copyright (C) 2023 CERN for the benefit of the Acts project
4
//
5
// This Source Code Form is subject to the terms of the Mozilla Public
6
// License, v. 2.0. If a copy of the MPL was not distributed with this
7
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
8
9
#pragma once
10
11
#include "
Acts/Plugins/ExaTrkX/Stages.hpp
"
12
#include "
Acts/Utilities/Logger.hpp
"
13
14
#include <memory>
15
16
namespace
torch::jit {
17
class
Module;
18
}
19
20
namespace
c10 {
21
enum class
DeviceType : int8_t;
22
}
23
24
namespace Acts {
25
26
class
TorchMetricLearning
final :
public
Acts::GraphConstructionBase
{
27
public
:
28
struct
Config
{
29
std::string
modelPath
;
30
int
numFeatures = 3;
31
int
embeddingDim = 8;
32
float
rVal = 1.6;
33
int
knnVal = 500;
34
bool
shuffleDirections =
false
;
35
};
36
37
TorchMetricLearning
(
const
Config
&
cfg
, std::unique_ptr<const Logger>
logger
);
38
~
TorchMetricLearning
();
39
40
std::tuple<std::any, std::any> operator()(std::vector<float> &inputValues,
41
std::size_t numNodes,
42
int
deviceHint = -1)
override
;
43
44
Config
config
()
const
{
return
m_cfg
; }
45
46
private
:
47
std::unique_ptr<const Acts::Logger>
m_logger
;
48
const
auto
&
logger
()
const
{
return
*
m_logger
; }
49
50
Config
m_cfg
;
51
c10::DeviceType
m_deviceType
;
52
std::unique_ptr<torch::jit::Module>
m_model
;
53
};
54
55
}
// namespace Acts
acts
blob
sPHENIX
Plugins
ExaTrkX
include
Acts
Plugins
ExaTrkX
TorchMetricLearning.hpp
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:17:41
using
1.8.2 with
sPHENIX GitHub integration