3#ifndef EDM4EIC_Tensor_H
4#define EDM4EIC_Tensor_H
8#include "podio/RelationRange.h"
12#include "podio/utilities/MaybeSharedPtr.h"
17#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
18#include "nlohmann/json_fwd.hpp"
26class TensorCollection;
27class TensorCollectionData;
48 Tensor(std::int32_t elementType);
76 std::int64_t
getShape(std::size_t)
const;
77 std::vector<std::int64_t>::const_iterator
shape_begin()
const;
78 std::vector<std::int64_t>::const_iterator
shape_end()
const;
79 podio::RelationRange<std::int64_t>
getShape()
const;
88 std::vector<std::int64_t>::const_iterator
int64Data_end()
const;
95 void unlink() { m_obj = podio::utils::MaybeSharedPtr<TensorObj>{
nullptr}; }
112 swap(a.m_obj, b.m_obj);
117 explicit Tensor(podio::utils::MaybeSharedPtr<TensorObj> obj);
120 podio::utils::MaybeSharedPtr<TensorObj> m_obj{
nullptr};
123std::ostream&
operator<<(std::ostream& o,
const Tensor& value);
125#if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
126void to_json(nlohmann::json& j,
const Tensor& value);
Definition MutableTensor.h:31
Definition TensorCollectionData.h:30
Definition TensorCollection.h:92
Definition TensorCollection.h:37
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
podio::ObjectID id() const
Definition Tensor.h:106
bool operator<(const Tensor &other) const
Definition Tensor.h:104
friend class TensorCollection
Definition Tensor.h:36
friend void swap(Tensor &a, Tensor &b)
Definition Tensor.h:110
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:97
const podio::ObjectID getObjectID() const
Definition Tensor.cc:192
friend class MutableTensor
Definition Tensor.h:35
void unlink()
disconnect from TensorObj instance
Definition Tensor.h:95
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:101
Tensor(const Tensor &other)=default
copy constructor
bool operator!=(const Tensor &other) const
Definition Tensor.h:100
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:18
Definition CalorimeterHit.cc:17
std::ostream & operator<<(std::ostream &o, const CalorimeterHit &value)
Definition CalorimeterHit.cc:103