MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / fill_borders_with_garbage

Method fill_borders_with_garbage

tests/AssetsLibrary.h:510–540  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

508
509template <typename T, typename D>
510void AssetsLibrary::fill_borders_with_garbage(T &&tensor,
511 D &&distribution,
512 std::random_device::result_type seed_offset) const
513{
514 const PaddingSize padding_size = tensor.padding();
515
516 Window window;
517 window.set(0, Window::Dimension(-padding_size.left, tensor.shape()[0] + padding_size.right, 1));
518 if (tensor.shape().num_dimensions() > 1)
519 {
520 window.set(1, Window::Dimension(-padding_size.top, tensor.shape()[1] + padding_size.bottom, 1));
521 }
522
523 std::mt19937 gen(_seed + seed_offset);
524
525 execute_window_loop(window,
526 [&](const Coordinates &id)
527 {
528 TensorShape shape = tensor.shape();
529
530 // If outside of valid region
531 if (id.x() < 0 || id.x() >= static_cast<int>(shape.x()) || id.y() < 0 ||
532 id.y() >= static_cast<int>(shape.y()))
533 {
534 using ResultType = typename std::remove_reference<D>::type::result_type;
535 const ResultType value = distribution(gen);
536 void *const out_ptr = tensor(id);
537 store_value_with_data_type(out_ptr, value, tensor.data_type());
538 }
539 });
540}
541
542template <typename T, typename D>
543void AssetsLibrary::fill_boxes(T &&tensor, D &&distribution, std::random_device::result_type seed_offset) const

Callers 6

fillMethod · 0.80
fillMethod · 0.80
fillMethod · 0.80
fillMethod · 0.80
fillMethod · 0.80
fillMethod · 0.80

Calls 9

DimensionClass · 0.50
paddingMethod · 0.45
setMethod · 0.45
shapeMethod · 0.45
num_dimensionsMethod · 0.45
xMethod · 0.45
yMethod · 0.45
data_typeMethod · 0.45

Tested by

no test coverage detected