tfp.experimental.distributions.marginal_fns.ps.eye
Stay organized with collections
Save and categorize content based on your preferences.
Construct an identity matrix, or a batch of matrices.
tfp.experimental.distributions.marginal_fns.ps.eye(
num_rows,
num_columns=None,
batch_shape=None,
dtype=dtypes.float32,
name=None
)
See also tf.ones
, tf.zeros
, tf.fill
, tf.one_hot
.
# Construct one identity matrix.
tf.eye(2)
==> [[1., 0.],
[0., 1.]]
# Construct a batch of 3 identity matrices, each 2 x 2.
# batch_identity[i, :, :] is a 2 x 2 identity matrix, i = 0, 1, 2.
batch_identity = tf.eye(2, batch_shape=[3])
# Construct one 2 x 3 "identity" matrix
tf.eye(2, num_columns=3)
==> [[ 1., 0., 0.],
[ 0., 1., 0.]]
Args |
num_rows
|
Non-negative int32 scalar Tensor giving the number of rows
in each batch matrix.
|
num_columns
|
Optional non-negative int32 scalar Tensor giving the number
of columns in each batch matrix. Defaults to num_rows .
|
batch_shape
|
A list or tuple of Python integers or a 1-D int32 Tensor .
If provided, the returned Tensor will have leading batch dimensions of
this shape.
|
dtype
|
The type of an element in the resulting Tensor
|
name
|
A name for this Op . Defaults to "eye".
|
Returns |
A Tensor of shape batch_shape + [num_rows, num_columns]
|
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 2023-10-03 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-10-03 UTC."],[],[]]