|
|
|
@ -55,13 +55,12 @@ int FillOpenCLKernel::RunShape() {
|
|
|
|
|
auto tensor_shape = in_tensors_[0]->shape();
|
|
|
|
|
void *tensor_shape_data = tensor_shape.data();
|
|
|
|
|
for (int i = 0; i < tensor_shape.size(); ++i) {
|
|
|
|
|
fill_value.s[0] = reinterpret_cast<float *>(tensor_shape_data)[i];
|
|
|
|
|
size_t index = static_cast<size_t>(i);
|
|
|
|
|
auto src_origin = cl::array<cl::size_type, 3U>{0, index, 0};
|
|
|
|
|
auto region = cl::array<cl::size_type, 3U>{1, 1, 1};
|
|
|
|
|
cl::Image2D *out_image = reinterpret_cast<cl::Image2D *>(allocator_->GetImage(src_data));
|
|
|
|
|
ocl_runtime_->GetDefaultCommandQueue()->enqueueFillImage(*out_image, fill_value, src_origin, region);
|
|
|
|
|
fill_value.s[i] = reinterpret_cast<float *>(tensor_shape_data)[i];
|
|
|
|
|
}
|
|
|
|
|
auto src_origin = cl::array<cl::size_type, 3U>{0, 0, 0};
|
|
|
|
|
auto region = cl::array<cl::size_type, 3U>{1, 1, 1};
|
|
|
|
|
cl::Image2D *out_image = reinterpret_cast<cl::Image2D *>(allocator_->GetImage(src_data));
|
|
|
|
|
ocl_runtime_->GetDefaultCommandQueue()->enqueueFillImage(*out_image, fill_value, src_origin, region);
|
|
|
|
|
return RET_OK;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|