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

Function _ImageDimensions

tensorflow/python/ops/image_ops_impl.py:99–118  ·  view source on GitHub ↗

Returns the dimensions of an image tensor. Args: image: A rank-D Tensor. For 3-D of shape: `[height, width, channels]`. rank: The expected rank of the image Returns: A list of corresponding to the dimensions of the input image. Dimensions that are statically known are python

(image, rank)

Source from the content-addressed store, hash-verified

97
98
99def _ImageDimensions(image, rank):
100 """Returns the dimensions of an image tensor.
101
102 Args:
103 image: A rank-D Tensor. For 3-D of shape: `[height, width, channels]`.
104 rank: The expected rank of the image
105
106 Returns:
107 A list of corresponding to the dimensions of the
108 input image. Dimensions that are statically known are python integers,
109 otherwise they are integer scalar tensors.
110 """
111 if image.get_shape().is_fully_defined():
112 return image.get_shape().as_list()
113 else:
114 static_shape = image.get_shape().with_rank(rank).as_list()
115 dynamic_shape = array_ops.unstack(array_ops.shape(image), rank)
116 return [
117 s if s is not None else d for s, d in zip(static_shape, dynamic_shape)
118 ]
119
120
121def _Check3DImage(image, require_static=True):

Callers 5

pad_to_bounding_boxFunction · 0.85
crop_to_bounding_boxFunction · 0.85
_resize_images_commonFunction · 0.85

Calls 6

is_fully_definedMethod · 0.80
with_rankMethod · 0.80
get_shapeMethod · 0.45
as_listMethod · 0.45
unstackMethod · 0.45
shapeMethod · 0.45

Tested by

no test coverage detected