MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / _flip

Function _flip

tensorflow/python/ops/image_ops_impl.py:456–484  ·  view source on GitHub ↗

Flip an image either horizontally or vertically. Outputs the contents of `image` flipped along the dimension `flip_index`. See also `reverse()`. Args: image: 4-D Tensor of shape `[batch, height, width, channels]` or 3-D Tensor of shape `[height, width, channels]`. flip_index:

(image, flip_index, scope_name)

Source from the content-addressed store, hash-verified

454
455
456def _flip(image, flip_index, scope_name):
457 """Flip an image either horizontally or vertically.
458
459 Outputs the contents of `image` flipped along the dimension `flip_index`.
460
461 See also `reverse()`.
462
463 Args:
464 image: 4-D Tensor of shape `[batch, height, width, channels]` or 3-D Tensor
465 of shape `[height, width, channels]`.
466 flip_index: 0 For vertical, 1 for horizontal.
467 scope_name: string, scope name.
468
469 Returns:
470 A `Tensor` of the same type and shape as `image`.
471
472 Raises:
473 ValueError: if the shape of `image` not supported.
474 """
475 with ops.name_scope(None, scope_name, [image]):
476 image = ops.convert_to_tensor(image, name='image')
477 image = _AssertAtLeast3DImage(image)
478 shape = image.get_shape()
479 if shape.ndims == 3 or shape.ndims is None:
480 return fix_image_flip_shape(image, array_ops.reverse(image, [flip_index]))
481 elif shape.ndims == 4:
482 return array_ops.reverse(image, [flip_index + 1])
483 else:
484 raise ValueError('\'image\' must have either 3 or 4 dimensions.')
485
486
487@tf_export('image.rot90')

Callers 2

flip_left_rightFunction · 0.70
flip_up_downFunction · 0.70

Calls 5

_AssertAtLeast3DImageFunction · 0.85
fix_image_flip_shapeFunction · 0.85
name_scopeMethod · 0.45
get_shapeMethod · 0.45
reverseMethod · 0.45

Tested by

no test coverage detected