5 #include "model_config.pb.h" 11 namespace nic = ni::client;
14 namespace inferenceserver {
26 template <
typename IO>
29 dims_(model_info.shape().
begin(), model_info.shape().
end()),
33 shape_(fullShape_.
begin() + (noBatch_ ? 0 : 1), fullShape_.
end()),
34 variableDims_(anyNeg(shape_)),
35 productDims_(variableDims_ ? -1 : dimProduct(shape_)),
36 dname_(model_info.datatype()),
52 nic::InferRequestedOutput::Create(ioptr,
name_);
56 template <
typename IO>
59 for (
unsigned i = 0; i < newShape.size(); ++i) {
60 result &=
setShape(i, newShape[i], canThrow);
65 template <
typename IO>
67 std::stringstream
msg;
68 unsigned full_loc = loc + (
noBatch_ ? 0 : 1);
72 msg <<
name_ <<
" setShape(): dimension " << full_loc <<
" out of bounds (" <<
fullShape_.size() <<
")";
82 if (
dims_[full_loc] == -1) {
86 msg <<
name_ <<
" setShape(): attempt to change value of non-variable shape dimension " <<
loc;
99 template <
typename IO>
108 template <
typename DT>
110 const auto& data_in = *ptr;
114 throw cet::exception(
"TritonDataError") <<
name_ <<
" input(): input vector has size " << data_in.size()
115 <<
" but specified batch size is " <<
batchSize_;
122 throw cet::exception(
"TritonDataError") <<
name_ <<
" input(): inconsistent byte size " <<
sizeof(DT)
126 for (
unsigned i0 = 0; i0 <
batchSize_; ++i0) {
127 const DT* arr = data_in[i0].data();
137 template <
typename DT>
144 throw cet::exception(
"TritonDataError") <<
name_ <<
" output(): inconsistent byte size " <<
sizeof(DT)
151 size_t contentByteSize;
154 if (contentByteSize != expectedContentByteSize) {
155 throw cet::exception(
"TritonDataError") <<
name_ <<
" output(): unexpected content byte size " << contentByteSize
156 <<
" (expected " << expectedContentByteSize <<
")";
159 const DT* r1 =
reinterpret_cast<const DT*
>(r0);
160 dataOut.reserve(batchSize_);
161 for (
unsigned i0 = 0; i0 <
batchSize_; ++i0) {
162 auto offset = i0 * nOutput;
163 dataOut.emplace_back(r1 + offset, r1 + offset + nOutput);
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
void setBatchSize(unsigned bsize)
bool setShape(const ShapeType &newShape)
void msg(const char *fmt,...)
std::vector< int64_t > ShapeType
void throwIfError(const Error &err, std::string_view msg)
void toServer(std::shared_ptr< TritonInput< DT >> ptr)
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
inference::DataType ProtocolStringToDataType(const std::string &dtype)
std::string to_string(ModuleType const mt)
size_t GetDataTypeByteSize(const inference::DataType dtype)
cet::coded_exception< error, detail::translate > exception