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"
24class TensorCollection;
36class TensorCollection;
37class TensorCollectionData;
59 Tensor(std::int32_t elementType);
81 static constexpr auto typeName =
"edm4eic::Tensor";
89 std::int64_t
getShape(std::size_t)
const;
90 std::vector<std::int64_t>::const_iterator
shape_begin()
const;
91 std::vector<std::int64_t>::const_iterator
shape_end()
const;
92 podio::RelationRange<std::int64_t>
getShape()
const;
101 std::vector<std::int64_t>::const_iterator
int64Data_end()
const;
102 podio::RelationRange<std::int64_t>
getInt64Data()
const;
108 void unlink() { m_obj = podio::utils::MaybeSharedPtr<TensorObj>{
nullptr}; }
125 swap(a.m_obj, b.m_obj);
130 explicit Tensor(podio::utils::MaybeSharedPtr<TensorObj> obj);
133 podio::utils::MaybeSharedPtr<TensorObj> m_obj{
nullptr};
136std::ostream&
operator<<(std::ostream& o,
const Tensor& value);
138#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
139void to_json(nlohmann::json& j,
const Tensor& value);
Definition MutableTensor.h:35
Definition TensorCollectionData.h:30
Definition TensorCollection.h:91
Definition TensorCollection.h:36
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
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
podio::RelationRange< float > getFloatData() const
Definition Tensor.cc:144
std::vector< std::int64_t >::const_iterator shape_end() const
Definition Tensor.cc:95
static constexpr auto typeName
Definition Tensor.h:81
podio::ObjectID id() const
Definition Tensor.h:119
bool operator<(const Tensor &other) const
Definition Tensor.h:117
friend class TensorCollection
Definition Tensor.h:46
friend void swap(Tensor &a, Tensor &b)
Definition Tensor.h:123
std::vector< float >::const_iterator floatData_end() const
Definition Tensor.cc:127
std::size_t shape_size() const
Definition Tensor.cc:101
Tensor()
default constructor
Definition Tensor.cc:20
bool operator==(const Tensor &other) const
Definition Tensor.h:110
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:108
podio::RelationRange< std::int64_t > getShape() const
Definition Tensor.cc:112
std::size_t int64Data_size() const
Definition Tensor.cc:165
Tensor & operator=(Tensor other)
copy-assignment operator
Definition Tensor.cc:28
bool operator!=(const MutableTensor &other) const
Definition Tensor.h:114
Tensor(const Tensor &other)=default
copy constructor
bool operator!=(const Tensor &other) const
Definition Tensor.h:113
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