tfm.vision.augment.to_4d
Stay organized with collections
Save and categorize content based on your preferences.
Converts an input Tensor to 4 dimensions.
tfm.vision.augment.to_4d(
image: tf.Tensor
) -> tf.Tensor
4D image => [N, H, W, C] or [N, C, H, W]
3D image => [1, H, W, C] or [1, C, H, W]
2D image => [1, H, W, 1]
Args |
image
|
The 2/3/4D input tensor.
|
Returns |
A 4D image tensor.
|
Raises |
TypeError if image is not a 2/3/4D tensor.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2024-02-02 UTC.
[null,null,["Last updated 2024-02-02 UTC."],[],[],null,["# tfm.vision.augment.to_4d\n\n\u003cbr /\u003e\n\n|-------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/models/blob/v2.15.0/official/vision/ops/augment.py#L43-L72) |\n\nConverts an input Tensor to 4 dimensions. \n\n tfm.vision.augment.to_4d(\n image: tf.Tensor\n ) -\u003e tf.Tensor\n\n4D image =\\\u003e \\[N, H, W, C\\] or \\[N, C, H, W\\]\n3D image =\\\u003e \\[1, H, W, C\\] or \\[1, C, H, W\\]\n2D image =\\\u003e \\[1, H, W, 1\\]\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|---------|--------------------------|\n| `image` | The 2/3/4D input tensor. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| A 4D image tensor. ||\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Raises ------ ||\n|---|---|\n| `TypeError` if `image` is not a 2/3/4D tensor. ||\n\n\u003cbr /\u003e"]]