Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OpenCL] Registers AdjustContrastv2 #93

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions tensorflow/core/kernels/adjust_contrast_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ namespace tensorflow {

typedef Eigen::ThreadPoolDevice CPUDevice;
typedef Eigen::GpuDevice GPUDevice;
#ifdef TENSORFLOW_USE_SYCL
typedef Eigen::SyclDevice SYCLDevice;
#endif

// AdjustContrastOp is deprecated as of GraphDef version >= 2

Expand Down Expand Up @@ -410,4 +413,25 @@ REGISTER_KERNEL_BUILDER(Name("AdjustContrastv2").Device(DEVICE_GPU),
AdjustContrastOpv2<GPUDevice>);
#endif // GOOGLE_CUDA

#ifdef TENSORFLOW_USE_SYCL
template <>
class AdjustContrastOpv2<SYCLDevice> : public AdjustContrastOpV2Base {
public:
explicit AdjustContrastOpv2(OpKernelConstruction* context)
: AdjustContrastOpV2Base(context) {}

void DoCompute(OpKernelContext* context,
const ComputeOptions& options) override {
const int64 shape[4] = {options.batch, options.height, options.width,
options.channels};
functor::AdjustContrastv2<SYCLDevice>()(
context->eigen_device<SYCLDevice>(),
options.input->shaped<float, 4>(shape), options.factor->scalar<float>(),
options.output->shaped<float, 4>(shape));
}
};
REGISTER_KERNEL_BUILDER(Name("AdjustContrastv2").Device(DEVICE_SYCL),
AdjustContrastOpv2<SYCLDevice>);
#endif // TENSORFLOW_USE_SYCL

} // namespace tensorflow