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

Function transpose

tensorflow/python/ops/image_ops_impl.py:591–617  ·  view source on GitHub ↗

Transpose image(s) by swapping the height and width dimension. Args: image: 4-D Tensor of shape `[batch, height, width, channels]` or 3-D Tensor of shape `[height, width, channels]`. name: A name for this operation (optional). Returns: If `image` was 4-D, a 4-D float Tensor o

(image, name=None)

Source from the content-addressed store, hash-verified

589
590@tf_export('image.transpose', v1=['image.transpose', 'image.transpose_image'])
591def transpose(image, name=None):
592 """Transpose image(s) by swapping the height and width dimension.
593
594 Args:
595 image: 4-D Tensor of shape `[batch, height, width, channels]` or 3-D Tensor
596 of shape `[height, width, channels]`.
597 name: A name for this operation (optional).
598
599 Returns:
600 If `image` was 4-D, a 4-D float Tensor of shape
601 `[batch, width, height, channels]`
602 If `image` was 3-D, a 3-D float Tensor of shape
603 `[width, height, channels]`
604
605 Raises:
606 ValueError: if the shape of `image` not supported.
607 """
608 with ops.name_scope(name, 'transpose', [image]):
609 image = ops.convert_to_tensor(image, name='image')
610 image = _AssertAtLeast3DImage(image)
611 shape = image.get_shape()
612 if shape.ndims == 3 or shape.ndims is None:
613 return array_ops.transpose(image, [1, 0, 2], name=name)
614 elif shape.ndims == 4:
615 return array_ops.transpose(image, [0, 2, 1, 3], name=name)
616 else:
617 raise ValueError('\'image\' must have either 3 or 4 dimensions.')
618
619
620@tf_export('image.central_crop')

Callers

nothing calls this directly

Calls 4

_AssertAtLeast3DImageFunction · 0.85
transposeMethod · 0.80
name_scopeMethod · 0.45
get_shapeMethod · 0.45

Tested by

no test coverage detected