| 30 | |
| 31 | struct TensorTupleUtil final { |
| 32 | static std::string ToString(const TensorTuple& tensor_tuple) { |
| 33 | std::stringstream ss; |
| 34 | int32_t idx = 0; |
| 35 | ss << "TensorTuple("; |
| 36 | for (const std::shared_ptr<Tensor>& tensor : tensor_tuple) { |
| 37 | ss << tensor; |
| 38 | if (++idx != tensor_tuple.size() || tensor_tuple.size() == 1) { ss << ", "; } |
| 39 | } |
| 40 | ss << ")"; |
| 41 | return ss.str(); |
| 42 | } |
| 43 | |
| 44 | static void MergeFrom(std::shared_ptr<TensorTuple>& tensor_tuple, const TensorTuple& other) { |
| 45 | for (const auto& tensor : other) { tensor_tuple->emplace_back(tensor); } |