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

Function ReplicateDepthRamp

tensorflow/lite/kernels/pooling_test.cc:102–115  ·  view source on GitHub ↗

Replicate each entry in a vector n times along depth (innermost dimension). The values are incremented by delta, creating ramps offset by each input value. This is used to create simple and predicatable variation.

Source from the content-addressed store, hash-verified

100// The values are incremented by delta, creating ramps offset by each input
101// value. This is used to create simple and predicatable variation.
102std::vector<float> ReplicateDepthRamp(const std::vector<float>& image_plane,
103 int n, float delta) {
104 const int size = image_plane.size();
105 std::vector<float> ramped_data(n * size);
106 // The input is treated as a 1-D even if logically it is multi-dimensional.
107 for (int input_index = 0; input_index < size; ++input_index) {
108 for (int depth = 0; depth < n; ++depth) {
109 ramped_data[n * input_index + depth] =
110 image_plane[input_index] + depth * delta;
111 }
112 }
113
114 return ramped_data;
115}
116
117TEST(FloatPoolingOpTest, AveragePool) {
118 FloatPoolingOpModel m(BuiltinOperator_AVERAGE_POOL_2D,

Callers 1

TESTFunction · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected