31std::ostream&
operator<<(std::ostream& os,
const std::vector<T>& data) {
33 if (data.size() > 0) {
34 for (
auto d = data.begin(); d != data.end() - 1; ++d) {
56 return std::accumulate(begin, end, 1l, [](std::int64_t a, std::int64_t b) {
return a * std::max(b, 1l); });
65inline void fail_on_error(
const triton::client::Error& err, std::string message =
"") {
67 throw std::runtime_error(message +
": " + err.Message());
77 static constexpr auto chars =
79 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
80 "abcdefghijklmnopqrstuvwxyz";
81 thread_local static std::mt19937 rng{std::random_device{}()};
82 thread_local static std::uniform_int_distribution<std::string::size_type> dist(0, std::strlen(chars) - 1);
84 std::string result(len,
'\0');
85 std::generate_n(begin(result), len, [&]() {
return chars[dist(rng)]; });
std::ostream & operator<<(std::ostream &os, const std::vector< T > &data)
Write a vector in bracketed, comma-separated form.
std::string randstring(std::size_t len)
Generate an alphanumeric random string.
void fail_on_error(const triton::client::Error &err, std::string message="")
Convert a failed Triton client status into a C++ exception.
std::int64_t accumulate_shape(It begin, It end)
Compute the element count represented by a tensor shape.