[TOC]
Assert the condition x < 0
holds element-wise.
Example of adding a dependency to an operation:
with tf.control_dependencies([tf.assert_negative(x)]):
output = tf.reduce_sum(x)
Example of adding dependency to the tensor being checked:
x = tf.with_dependencies([tf.assert_negative(x)], x)
Negative means, for every element x[i]
of x
, we have x[i] < 0
.
If x
is empty this is trivially satisfied.
x
: NumericTensor
.data
: The tensors to print out if the condition is False. Defaults to error message and first few entries ofx
.summarize
: Print this many entries of each tensor.name
: A name for this operation (optional). Defaults to "assert_negative".
Op raising InvalidArgumentError
unless x
is all negative.
Assert the condition x > 0
holds element-wise.
Example of adding a dependency to an operation:
with tf.control_dependencies([tf.assert_positive(x)]):
output = tf.reduce_sum(x)
Example of adding dependency to the tensor being checked:
x = tf.with_dependencies([tf.assert_positive(x)], x)
Positive means, for every element x[i]
of x
, we have x[i] > 0
.
If x
is empty this is trivially satisfied.
x
: NumericTensor
.data
: The tensors to print out if the condition is False. Defaults to error message and first few entries ofx
.summarize
: Print this many entries of each tensor.name
: A name for this operation (optional). Defaults to "assert_positive".
Op raising InvalidArgumentError
unless x
is all positive.
Assert the condition x >= 0
holds element-wise.
Example of adding a dependency to an operation:
with tf.control_dependencies([tf.assert_non_negative(x)]):
output = tf.reduce_sum(x)
Example of adding dependency to the tensor being checked:
x = tf.with_dependencies([tf.assert_non_negative(x)], x)
Non-negative means, for every element x[i]
of x
, we have x[i] >= 0
.
If x
is empty this is trivially satisfied.
x
: NumericTensor
.data
: The tensors to print out if the condition is False. Defaults to error message and first few entries ofx
.summarize
: Print this many entries of each tensor.name
: A name for this operation (optional). Defaults to "assert_non_negative".
Op raising InvalidArgumentError
unless x
is all non-negative.
Assert the condition x <= 0
holds element-wise.
Example of adding a dependency to an operation:
with tf.control_dependencies([tf.assert_non_positive(x)]):
output = tf.reduce_sum(x)
Example of adding dependency to the tensor being checked:
x = tf.with_dependencies([tf.assert_non_positive(x)], x)
Non-positive means, for every element x[i]
of x
, we have x[i] <= 0
.
If x
is empty this is trivially satisfied.
x
: NumericTensor
.data
: The tensors to print out if the condition is False. Defaults to error message and first few entries ofx
.summarize
: Print this many entries of each tensor.name
: A name for this operation (optional). Defaults to "assert_non_positive".
Op raising InvalidArgumentError
unless x
is all non-positive.
Assert the condition x == y
holds element-wise.
Example of adding a dependency to an operation:
with tf.control_dependencies([tf.assert_equal(x, y)]):
output = tf.reduce_sum(x)
Example of adding dependency to the tensor being checked:
x = tf.with_dependencies([tf.assert_equal(x, y)], x)
This condition holds if for every pair of (possibly broadcast) elements
x[i]
, y[i]
, we have x[i] == y[i]
.
If both x
and y
are empty, this is trivially satisfied.
x
: NumericTensor
.y
: NumericTensor
, same dtype as and broadcastable tox
.data
: The tensors to print out if the condition is False. Defaults to error message and first few entries ofx
,y
.summarize
: Print this many entries of each tensor.name
: A name for this operation (optional). Defaults to "assert_equal".
Op that raises InvalidArgumentError
if x == y
is False.
Assert the condition x < y
holds element-wise.
Example of adding a dependency to an operation:
with tf.control_dependencies([tf.assert_less(x, y)]):
output = tf.reduce_sum(x)
Example of adding dependency to the tensor being checked:
x = tf.with_dependencies([tf.assert_less(x, y)], x)
This condition holds if for every pair of (possibly broadcast) elements
x[i]
, y[i]
, we have x[i] < y[i]
.
If both x
and y
are empty, this is trivially satisfied.
x
: NumericTensor
.y
: NumericTensor
, same dtype as and broadcastable tox
.data
: The tensors to print out if the condition is False. Defaults to error message and first few entries ofx
,y
.summarize
: Print this many entries of each tensor.name
: A name for this operation (optional). Defaults to "assert_less".
Op that raises InvalidArgumentError
if x < y
is False.
Assert the condition x <= y
holds element-wise.
Example of adding a dependency to an operation:
with tf.control_dependencies([tf.assert_less_equal(x, y)]):
output = tf.reduce_sum(x)
Example of adding dependency to the tensor being checked:
x = tf.with_dependencies([tf.assert_less_equal(x, y)], x)
This condition holds if for every pair of (possibly broadcast) elements
x[i]
, y[i]
, we have x[i] <= y[i]
.
If both x
and y
are empty, this is trivially satisfied.
x
: NumericTensor
.y
: NumericTensor
, same dtype as and broadcastable tox
.data
: The tensors to print out if the condition is False. Defaults to error message and first few entries ofx
,y
.summarize
: Print this many entries of each tensor.name
: A name for this operation (optional). Defaults to "assert_less_equal"
Op that raises InvalidArgumentError
if x <= y
is False.
Assert x
has rank equal to rank
.
Example of adding a dependency to an operation:
with tf.control_dependencies([tf.assert_rank(x, 2)]):
output = tf.reduce_sum(x)
Example of adding dependency to the tensor being checked:
x = tf.with_dependencies([tf.assert_rank(x, 2)], x)
x
: NumericTensor
.rank
: ScalarTensor
.data
: The tensors to print out if the condition is False. Defaults to error message and first few entries ofx
.summarize
: Print this many entries of each tensor.name
: A name for this operation (optional). Defaults to "assert_rank".
Op raising InvalidArgumentError
unless x
has specified rank.
ValueError
: If static checks determinex
has wrong rank.
Assert x
has rank equal to rank
or higher.
Example of adding a dependency to an operation:
with tf.control_dependencies([tf.assert_rank_at_least(x, 2)]):
output = tf.reduce_sum(x)
Example of adding dependency to the tensor being checked:
x = tf.with_dependencies([tf.assert_rank_at_least(x, 2)], x)
x
: NumericTensor
.rank
: ScalarTensor
.data
: The tensors to print out if the condition is False. Defaults to error message and first few entries ofx
.summarize
: Print this many entries of each tensor.name
: A name for this operation (optional). Defaults to "assert_rank_at_least".
Op raising InvalidArgumentError
unless x
has specified rank or higher.
ValueError
: If static checks determinex
has wrong rank.
Assert that x
is of integer dtype.
Example of adding a dependency to an operation:
with tf.control_dependencies([tf.assert_integer(x)]):
output = tf.reduce_sum(x)
Example of adding dependency to the tensor being checked:
x = tf.with_dependencies([tf.assert_integer(x)], x)
x
:Tensor
whose basetype is integer and is not quantized.data
: The tensors to print out if the condition is False. Defaults to error message and first few entries ofx
.summarize
: Print this many entries of each tensor.name
: A name for this operation (optional). Defaults to "assert_integer".
Op that raises InvalidArgumentError
if x == y
is False.
Returns True
if x
is non-decreasing.
Elements of x
are compared in row-major order. The tensor [x[0],...]
is non-decreasing if for every adjacent pair we have x[i] <= x[i+1]
.
If x
has less than two elements, it is trivially non-decreasing.
See also: is_strictly_increasing
x
: NumericTensor
.name
: A name for this operation (optional). Defaults to "is_non_decreasing"
Boolean Tensor
, equal to True
iff x
is non-decreasing.
TypeError
: ifx
is not a numeric tensor.
Returns True
if x
is strictly increasing.
Elements of x
are compared in row-major order. The tensor [x[0],...]
is strictly increasing if for every adjacent pair we have x[i] < x[i+1]
.
If x
has less than two elements, it is trivially strictly increasing.
See also: is_non_decreasing
x
: NumericTensor
.name
: A name for this operation (optional). Defaults to "is_strictly_increasing"
Boolean Tensor
, equal to True
iff x
is strictly increasing.
TypeError
: ifx
is not a numeric tensor.