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

Function _rot90_3D

tensorflow/python/ops/image_ops_impl.py:527–555  ·  view source on GitHub ↗

Rotate image counter-clockwise by 90 degrees `k` times. Args: image: 3-D Tensor of shape `[height, width, channels]`. k: A scalar integer. The number of times the image is rotated by 90 degrees. name_scope: A valid TensorFlow name scope. Returns: A 3-D tensor of the same type a

(image, k, name_scope)

Source from the content-addressed store, hash-verified

525
526
527def _rot90_3D(image, k, name_scope):
528 """Rotate image counter-clockwise by 90 degrees `k` times.
529
530 Args:
531 image: 3-D Tensor of shape `[height, width, channels]`.
532 k: A scalar integer. The number of times the image is rotated by 90 degrees.
533 name_scope: A valid TensorFlow name scope.
534
535 Returns:
536 A 3-D tensor of the same type and shape as `image`.
537
538 """
539
540 def _rot90():
541 return array_ops.transpose(array_ops.reverse_v2(image, [1]), [1, 0, 2])
542
543 def _rot180():
544 return array_ops.reverse_v2(image, [0, 1])
545
546 def _rot270():
547 return array_ops.reverse_v2(array_ops.transpose(image, [1, 0, 2]), [1])
548
549 cases = [(math_ops.equal(k, 1), _rot90), (math_ops.equal(k, 2), _rot180),
550 (math_ops.equal(k, 3), _rot270)]
551
552 result = control_flow_ops.case(
553 cases, default=lambda: image, exclusive=True, name=name_scope)
554 result.set_shape([None, None, image.get_shape()[2]])
555 return result
556
557
558def _rot90_4D(images, k, name_scope):

Callers 1

rot90Function · 0.85

Calls 4

equalMethod · 0.80
caseMethod · 0.80
set_shapeMethod · 0.45
get_shapeMethod · 0.45

Tested by

no test coverage detected