Esempio n. 1
0
def _ResizeNearestNeighborGrad(op, grad):
  """The derivatives for nearest neighbor resizing.

  Args:
    op: The ResizeNearestNeighbor op.
    grad: The tensor representing the gradient w.r.t. the output.

  Returns:
    The gradients w.r.t. the input and the output.
  """
  # pylint: disable=protected-access
  grads = gen_image_ops._resize_nearest_neighbor_grad(
      grad, op.inputs[0].get_shape()[1:3])
  # pylint: enable=protected-access
  return [grads, None]
Esempio n. 2
0
def _ResizeNearestNeighborGrad(op, grad):
    """The derivatives for nearest neighbor resizing.

  Args:
    op: The ResizeNearestNeighbor op.
    grad: The tensor representing the gradient w.r.t. the output.

  Returns:
    The gradients w.r.t. the input and the output.
  """
    # pylint: disable=protected-access
    grads = gen_image_ops._resize_nearest_neighbor_grad(
        grad, op.inputs[0].get_shape()[1:3])
    # pylint: enable=protected-access
    return [grads, None]
Esempio n. 3
0
def _ResizeNearestNeighborGrad(op, grad):
    """The derivatives for nearest neighbor resizing.

  Args:
    op: The ResizeNearestNeighbor op.
    grad: The tensor representing the gradient w.r.t. the output.

  Returns:
    The gradients w.r.t. the input and the output.
  """
    image = op.inputs[0]
    if image.get_shape()[1:3].is_fully_defined():
        image_shape = image.get_shape()[1:3]
    else:
        image_shape = array_ops.shape(image)[1:3]

    # pylint: disable=protected-access
    grads = gen_image_ops._resize_nearest_neighbor_grad(
        grad, image_shape, align_corners=op.get_attr("align_corners"))
    # pylint: enable=protected-access
    return [grads, None]
Esempio n. 4
0
def _ResizeNearestNeighborGrad(op, grad):
  """The derivatives for nearest neighbor resizing.

  Args:
    op: The ResizeNearestNeighbor op.
    grad: The tensor representing the gradient w.r.t. the output.

  Returns:
    The gradients w.r.t. the input and the output.
  """
  image = op.inputs[0]
  if image.get_shape()[1:3].is_fully_defined():
    image_shape = image.get_shape()[1:3]
  else:
    image_shape = array_ops.shape(image)[1:3]

  # pylint: disable=protected-access
  grads = gen_image_ops._resize_nearest_neighbor_grad(
      grad,
      image_shape,
      align_corners=op.get_attr("align_corners"))
  # pylint: enable=protected-access
  return [grads, None]