from tensorflow.python.framework import ops

  guide_tensor = op.inputs[1]
  input_tensor = op.inputs[2]
  has_offset = op.get_attr('has_offset')
  return _hdrnet.bilateral_slice_apply_grad(
      grid_tensor, guide_tensor, input_tensor, grad, has_offset=has_offset) 


# ----------- Register Shape inference ----------------------------------------
@ops.RegisterShape('BilateralSlice')
def _bilateral_slice_shape(op):
  input_tensor = op.inputs[0]
  guide_tensor = op.inputs[1]
  return [guide_tensor.get_shape().concatenate(input_tensor.get_shape()[-1])]


@ops.RegisterShape('BilateralSliceApply')
