43 Shape in_shape{3, 3, 4};
44 std::vector<float> input_data(in_shape.element_count());
45 for (
size_t i = 0; i < in_shape.element_count(); ++i)
51 Shape indices_shape{1, 3, 2};
52 std::vector<int> indices_data(indices_shape.element_count());
53 Array<int> indices(indices_data.data(), indices_shape);
55 indices.
slice(0, 0) = {0, 0};
56 indices.
slice(0, 1) = {1, 1};
57 indices.
slice(0, 2) = {2, 2};
60 std::vector<float> output_data(
output_shape.element_count());
66 for (
size_t i = 0; i < indices_shape.dim(0); ++i)
68 for (
size_t j = 0; j < indices_shape.dim(1); ++j)
70 auto output_piece = output.slice(i, j);
71 std::ostream_iterator<int> cout_it(std::cout,
", ");
72 std::copy(output_piece.begin(), output_piece.end(), cout_it);
73 std::cout << std::endl;