3#ifndef EDM4EIC_Tensor_H
4#define EDM4EIC_Tensor_H
8#include "podio/RelationRange.h"
12#include "podio/utilities/MaybeSharedPtr.h"
13#include "podio/detail/OrderKey.h"
18#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
19#include "nlohmann/json_fwd.hpp"
59 Tensor(
const std::int32_t elementType);
82 static constexpr std::string_view
typeName =
"edm4eic::Tensor";
90 std::int64_t
getShape(std::size_t)
const;
91 std::vector<std::int64_t>::const_iterator
shape_begin()
const;
92 std::vector<std::int64_t>::const_iterator
shape_end()
const;
93 podio::RelationRange<std::int64_t>
getShape()
const;
102 std::vector<std::int64_t>::const_iterator
int64Data_end()
const;
103 podio::RelationRange<std::int64_t>
getInt64Data()
const;
109 void unlink() { m_obj = podio::utils::MaybeSharedPtr<TensorObj>{
nullptr}; }
124 friend std::hash<Tensor>;
128 swap(a.m_obj, b.m_obj);
133 explicit Tensor(podio::utils::MaybeSharedPtr<TensorObj> obj);
136 podio::utils::MaybeSharedPtr<TensorObj> m_obj{
new TensorObj{}, podio::utils::MarkOwned};
141#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
142void to_json(nlohmann::json& j,
const Tensor& value);
153 return std::hash<edm4eic::TensorObj*>{}(obj.m_obj.get());
161#if defined(__clang__)
162 #pragma clang diagnostic push
163 #pragma clang diagnostic ignored "-Wunknown-warning-option"
164 #pragma clang diagnostic ignored "-Wdeprecated-redundant-constexpr-static-def"
165 #pragma clang diagnostic ignored "-Wdeprecated"
167 #pragma clang diagnostic pop
168#elif defined(__GNUC__)
169 #pragma GCC diagnostic push
170 #pragma GCC diagnostic ignored "-Wdeprecated"
172 #pragma GCC diagnostic pop
Definition MutableTensor.h:35
Definition TensorCollectionData.h:31
Definition TensorCollection.h:138
std::vector< std::int64_t >::const_iterator int64Data_begin() const
Definition Tensor.cc:149
MutableTensor clone(bool cloneRelations=true) const
Definition Tensor.cc:29
bool isAvailable() const
check whether the object is actually available
Definition Tensor.cc:184
std::vector< float >::const_iterator floatData_begin() const
Definition Tensor.cc:117
podio::RelationRange< std::int64_t > getInt64Data() const
Definition Tensor.cc:172
static constexpr std::string_view typeName
Definition Tensor.h:82
MutableTensor mutable_type
Definition Tensor.h:52
std::vector< std::int64_t >::const_iterator int64Data_end() const
Definition Tensor.cc:155
std::int32_t getElementType() const
Access the Data type in the same encoding as "ONNXTensorElementDataType", 1 - float,...
Definition Tensor.cc:81
std::size_t floatData_size() const
Definition Tensor.cc:129
Tensor & operator=(Tensor other) &&=delete
podio::RelationRange< float > getFloatData() const
Definition Tensor.cc:140
TensorCollection collection_type
Definition Tensor.h:53
std::vector< std::int64_t >::const_iterator shape_end() const
Definition Tensor.cc:91
podio::ObjectID id() const
Definition Tensor.h:120
bool operator<(const Tensor &other) const
Definition Tensor.h:118
friend class TensorCollectionIterator
Definition Tensor.h:48
friend class TensorCollection
Definition Tensor.h:46
friend void swap(Tensor &a, Tensor &b)
Definition Tensor.h:126
std::vector< float >::const_iterator floatData_end() const
Definition Tensor.cc:123
std::size_t shape_size() const
Definition Tensor.cc:97
Tensor & operator=(Tensor other) &
copy-assignment operator
Definition Tensor.cc:24
bool operator==(const Tensor &other) const
Definition Tensor.h:111
const podio::ObjectID getObjectID() const
Definition Tensor.cc:188
friend class MutableTensor
Definition Tensor.h:45
void unlink()
disconnect from TensorObj instance
Definition Tensor.h:109
podio::RelationRange< std::int64_t > getShape() const
Definition Tensor.cc:108
std::size_t int64Data_size() const
Definition Tensor.cc:161
bool operator!=(const MutableTensor &other) const
Definition Tensor.h:115
Tensor(const Tensor &other)=default
copy constructor
bool operator!=(const Tensor &other) const
Definition Tensor.h:114
static Tensor makeEmpty()
Definition Tensor.cc:77
~Tensor()=default
destructor
std::vector< std::int64_t >::const_iterator shape_begin() const
Definition Tensor.cc:85
Tensor()=default
default constructor
Definition TensorObj.h:19
Definition CalorimeterHit.cc:17
std::ostream & operator<<(std::ostream &o, const CalorimeterHit &value)
Definition CalorimeterHit.cc:99
Definition CalorimeterHit.h:31
OrderKey getOrderKey(const edm4eic::CalorimeterHit &obj)
Definition CalorimeterHit.cc:146
std::size_t operator()(const edm4eic::Tensor &obj) const
Definition Tensor.h:152