8 namespace ni = triton::common;
9 namespace nic = triton::client;
16 template <
typename IO>
21 , dims_(model_info.shape().
begin(), model_info.shape().
end())
25 , shape_(fullShape_.
begin() + (noBatch_ ? 0 : 1), fullShape_.
end())
26 , variableDims_(anyNeg(shape_))
27 , productDims_(variableDims_ ? -1 : dimProduct(shape_))
28 , dname_(model_info.datatype())
29 , dtype_(ni::ProtocolStringToDataType(dname_))
30 , byteSize_(ni::GetDataTypeByteSize(dtype_))
47 nic::InferRequestedOutput::Create(ioptr,
name_);
51 template <
typename IO>
55 for (
unsigned i = 0; i < newShape.size(); ++i) {
56 result &=
setShape(i, newShape[i], canThrow);
61 template <
typename IO>
64 std::stringstream msg;
65 unsigned full_loc = loc + (
noBatch_ ? 0 : 1);
69 msg <<
name_ <<
" setShape(): dimension " << full_loc <<
" out of bounds (" 80 if (
dims_[full_loc] == -1) {
85 msg <<
name_ <<
" setShape(): attempt to change value of non-variable shape dimension " 99 template <
typename IO>
109 template <
typename DT>
118 <<
name_ <<
" output(): inconsistent byte size " <<
sizeof(DT) <<
" (should be " 125 size_t contentByteSize;
128 "output(): unable to get raw");
129 if (contentByteSize != expectedContentByteSize) {
131 <<
name_ <<
" output(): unexpected content byte size " << contentByteSize <<
" (expected " 132 << expectedContentByteSize <<
")";
135 const DT* r1 =
reinterpret_cast<const DT*
>(r0);
136 dataOut.reserve(batchSize_);
137 for (
unsigned i0 = 0; i0 <
batchSize_; ++i0) {
138 auto offset = i0 * nOutput;
139 dataOut.emplace_back(r1 + offset, r1 + offset + nOutput);
void setBatchSize(unsigned bsize)
bool setShape(const ShapeType &newShape)
TritonData(const std::string &name, const TensorMetadata &model_info, bool noBatch)
std::vector< int64_t > ShapeType
void throwIfError(const Error &err, std::string_view msg)
void toServer(std::shared_ptr< TritonInput< DT >> ptr)
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
std::vector< std::vector< DT >> TritonInput
int64_t sizeShape() const
void createObject(IO **ioptr) const
std::shared_ptr< Result > result_
std::vector< triton_span::Span< const DT * >> TritonOutput
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
std::shared_ptr< IO > data_
inference::ModelMetadataResponse_TensorMetadata TensorMetadata
#define MF_LOG_WARNING(category)
TritonOutput< DT > fromServer() const
cet::coded_exception< error, detail::translate > exception