We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b11cce8 commit 0c55c99Copy full SHA for 0c55c99
runtime/compute/cker/include/cker/Shape.h
@@ -205,7 +205,10 @@ class Shape
205
// Replaces the current shape with a new one defined by dimensions_count and dims_data.
206
inline void ReplaceWith(int dimensions_count, const int32_t *dims_data)
207
{
208
- assert(dims_data != nullptr);
+ // Allow dims_data to be nullptr when dimensions_count is 0,
209
+ // because there are no dimensions to copy. For any non-zero dimensions_count,
210
+ // dims_data must not be nullptr to ensure valid shape data is provided.
211
+ assert(dimensions_count == 0 || dims_data != nullptr);
212
Resize(dimensions_count);
213
std::memcpy(DimsData(), dims_data, dimensions_count * sizeof(int32_t));
214
}
0 commit comments