1 #ifndef NuSonic_Triton_TritonData 2 #define NuSonic_Triton_TritonData 4 #include "cetlib_except/exception.h" 13 #include <unordered_map> 16 #include "grpc_client.h" 17 #include "triton/common/model_config.h" 19 namespace nic = triton::client;
27 template <
typename DT>
29 template <
typename DT>
33 template <
typename IO>
49 template <
typename DT>
52 const auto& data_in = *ptr;
57 <<
name_ <<
" input(): input vector has size " << data_in.size()
58 <<
" but specified batch size is " <<
batchSize_;
66 <<
name_ <<
" input(): inconsistent byte size " <<
sizeof(DT) <<
" (should be " 70 const DT* arr = data_in[i0].data();
72 data_->AppendRaw(reinterpret_cast<const uint8_t*>(arr), data_in[i0].size() *
byteSize_),
80 template <
typename DT>
100 bool setShape(
unsigned loc, int64_t val,
bool canThrow);
109 return std::any_of(vec.
begin(), vec.
end(), [](int64_t i) {
return i < 0; });
113 return std::accumulate(vec.
begin(), vec.
end(), 1, std::multiplies<int64_t>());
std::unordered_map< std::string, TritonOutputData > TritonOutputMap
void setBatchSize(unsigned bsize)
bool setShape(const ShapeType &newShape)
TritonData(const std::string &name, const TensorMetadata &model_info, bool noBatch)
bool anyNeg(const ShapeView &vec) const
bool variableDims() const
const ShapeView & shape() const
std::vector< int64_t > ShapeType
inference::DataType dtype_
void throwIfError(const Error &err, std::string_view msg)
void setResult(std::shared_ptr< Result > result)
void toServer(std::shared_ptr< TritonInput< DT >> ptr)
decltype(auto) constexpr to_string(T &&obj)
ADL-aware version of std::to_string.
std::vector< std::vector< DT >> TritonInput
unsigned batchSize() const
int64_t sizeShape() const
void createObject(IO **ioptr) const
bool setShape(unsigned loc, int64_t val)
std::shared_ptr< Result > result_
std::vector< triton_span::Span< const DT * >> TritonOutput
std::shared_ptr< IO > data_
int64_t dimProduct(const ShapeView &vec) const
const std::string & dname() const
std::unordered_map< std::string, TritonInputData > TritonInputMap
inference::ModelMetadataResponse_TensorMetadata TensorMetadata
TritonOutput< DT > fromServer() const
cet::coded_exception< error, detail::translate > exception