| 132 | } |
| 133 | |
| 134 | std::string GetWritingPart(int num_output_slices) { |
| 135 | std::string code; |
| 136 | for (int d = 0; d < num_output_slices; ++d) { |
| 137 | code += absl::Substitute(R"( |
| 138 | { |
| 139 | int dst_address = int(gid.y) * params.size.z + int(gid.x); |
| 140 | FLT4 value = FLT4(sum$0) + temp[$0]; |
| 141 | const int linear_index = gid.z * params.dillation_layer_offsets.w + dst_address; |
| 142 | $$2 |
| 143 | dst_buffer[linear_index + params.z_offset.y] = value; |
| 144 | gid.z += 1; |
| 145 | })", |
| 146 | d); |
| 147 | } |
| 148 | return code; |
| 149 | } |
| 150 | |
| 151 | std::string GetKernelForConv(const Convolution2DAttributes& params) { |
| 152 | const int num_output_slices = GetNumOutputSlices(params.weights.shape.o); |