| 56 | } |
| 57 | |
| 58 | std::string VariableShapeTensorType::ToString(bool show_metadata) const { |
| 59 | std::stringstream ss; |
| 60 | ss << "extension<" << this->extension_name() |
| 61 | << "[value_type=" << value_type_->ToString(show_metadata) << ", ndim=" << ndim_; |
| 62 | |
| 63 | if (!permutation_.empty()) { |
| 64 | ss << ", permutation=" << ::arrow::internal::PrintVector{permutation_, ","}; |
| 65 | } |
| 66 | if (!dim_names_.empty()) { |
| 67 | ss << ", dim_names=[" << internal::JoinStrings(dim_names_, ",") << "]"; |
| 68 | } |
| 69 | if (!uniform_shape_.empty()) { |
| 70 | std::vector<std::string> uniform_shape; |
| 71 | for (const auto& v : uniform_shape_) { |
| 72 | if (v.has_value()) { |
| 73 | uniform_shape.emplace_back(std::to_string(v.value())); |
| 74 | } else { |
| 75 | uniform_shape.emplace_back("null"); |
| 76 | } |
| 77 | } |
| 78 | ss << ", uniform_shape=[" << internal::JoinStrings(uniform_shape, ",") << "]"; |
| 79 | } |
| 80 | ss << "]>"; |
| 81 | return ss.str(); |
| 82 | } |
| 83 | |
| 84 | std::string VariableShapeTensorType::Serialize() const { |
| 85 | rj::Document document; |
no test coverage detected