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{
nullptr};
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:30
Definition TensorCollection.h:137
std::vector< std::int64_t >::const_iterator int64Data_begin() const
Definition Tensor.cc:153
MutableTensor clone(bool cloneRelations=true) const
Definition Tensor.cc:33
bool isAvailable() const
check whether the object is actually available
Definition Tensor.cc:188
std::vector< float >::const_iterator floatData_begin() const
Definition Tensor.cc:121
podio::RelationRange< std::int64_t > getInt64Data() const
Definition Tensor.cc:176
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:159
std::int32_t getElementType() const
Access the Data type in the same encoding as "ONNXTensorElementDataType", 1 - float,...
Definition Tensor.cc:85
std::size_t floatData_size() const
Definition Tensor.cc:133
Tensor & operator=(Tensor other) &&=delete
podio::RelationRange< float > getFloatData() const
Definition Tensor.cc:144
TensorCollection collection_type
Definition Tensor.h:53
std::vector< std::int64_t >::const_iterator shape_end() const
Definition Tensor.cc:95
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:127
std::size_t shape_size() const
Definition Tensor.cc:101
Tensor & operator=(Tensor other) &
copy-assignment operator
Definition Tensor.cc:28
Tensor()
default constructor
Definition Tensor.cc:20
bool operator==(const Tensor &other) const
Definition Tensor.h:111
const podio::ObjectID getObjectID() const
Definition Tensor.cc:192
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:112
std::size_t int64Data_size() const
Definition Tensor.cc:165
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:81
~Tensor()=default
destructor
std::vector< std::int64_t >::const_iterator shape_begin() const
Definition Tensor.cc:89
Definition TensorObj.h:19
Definition CalorimeterHit.cc:17
std::ostream & operator<<(std::ostream &o, const CalorimeterHit &value)
Definition CalorimeterHit.cc:103
Definition CalorimeterHit.h:31
OrderKey getOrderKey(const edm4eic::CalorimeterHit &obj)
Definition CalorimeterHit.cc:150
std::size_t operator()(const edm4eic::Tensor &obj) const
Definition Tensor.h:152