tfg.geometry.representation.grid.generate
Generates a M-D uniform axis-aligned grid.
tfg.geometry.representation.grid.generate(
starts, stops, nums, name='grid_generate'
)
Warning |
This op is not differentiable. Indeed, the gradient of tf.linspace and
tf.meshgrid are currently not defined.
|
Note |
In the following, B is an optional batch dimension.
|
Args |
starts
|
A tensor of shape [M] or [B, M] , where the last dimension
represents a M-D start point.
|
stops
|
A tensor of shape [M] or [B, M] , where the last dimension
represents a M-D end point.
|
nums
|
A tensor of shape [M] representing the number of subdivisions for
each dimension.
|
name
|
A name for this op. Defaults to "grid_generate".
|
Returns |
A tensor of shape [nums[0], ..., nums[M-1], M] containing an M-D uniform
grid or a tensor of shape [B, nums[0], ..., nums[M-1], M] containing B
M-D uniform grids. Please refer to the example below for more details.
|
Raises |
ValueError
|
If the shape of starts , stops , or nums is not supported.
|
Examples |
print(generate((-1.0, -2.0), (1.0, 2.0), (3, 5)))
[[[-1. -2.]
[-1. -1.]
[-1. 0.]
[-1. 1.]
[-1. 2.]]
[[ 0. -2.]
[ 0. -1.]
[ 0. 0.]
[ 0. 1.]
[ 0. 2.]]
[[ 1. -2.]
[ 1. -1.]
[ 1. 0.]
[ 1. 1.]
[ 1. 2.]]]
Generates a 3x5 2d grid from -1.0 to 1.0 with 3 subdivisions for the x
axis and from -2.0 to 2.0 with 5 subdivisions for the y axis. This lead to a
tensor of shape (3, 5, 2).
|
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.
Last updated 2022-10-28 UTC.
[null,null,["Last updated 2022-10-28 UTC."],[],[]]