MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / Fill

Function Fill

tensorflow/compiler/xla/tools/driver.cc:354–385  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

352}
353
354void Fill(void* buffer, const ArrayShape& shape) {
355 int num_elements = GetNumElements(shape);
356 Log("Number of elements = " + std::to_string(num_elements));
357 Log("Shape type = " + ToString(shape.type) +
358 ", shape = " + ArrayShapeToString(shape));
359 switch (shape.type) {
360 case S16:
361 return FillIntT<short>(buffer, num_elements); // NOLINT
362 case S32:
363 return FillIntT<int>(buffer, num_elements);
364 case S64:
365 return FillIntT<long long>(buffer, num_elements); // NOLINT
366 case U8:
367 return FillIntT<unsigned char>(buffer, num_elements);
368 case U16:
369 return FillIntT<unsigned short>(buffer, num_elements); // NOLINT
370 case U32:
371 return FillIntT<unsigned int>(buffer, num_elements);
372 case U64:
373 return FillIntT<unsigned long long>(buffer, num_elements); // NOLINT
374 case F32:
375 return FillFloatT<float>(buffer, num_elements);
376 case F64:
377 return FillFloatT<double>(buffer, num_elements);
378
379 case F16:
380 case BF16:
381 case C64:
382 case C128:
383 ExitWithMsg("Unsupported type: " + ToString(shape.type));
384 }
385}
386
387template <typename T>
388#if defined(MEMORY_SANITIZER)

Callers 4

mainFunction · 0.70
ArrayMethod · 0.50
TEST_FFunction · 0.50
SignGradFunction · 0.50

Calls 6

GetNumElementsFunction · 0.85
to_stringFunction · 0.85
ArrayShapeToStringFunction · 0.85
ExitWithMsgFunction · 0.85
LogFunction · 0.70
ToStringFunction · 0.70

Tested by 1

TEST_FFunction · 0.40