def _check_paddings(self, paddings): with tf.name_scope('check_paddings'): unpacked_paddings = tf.unstack(paddings) non_decr = [] for t in unpacked_paddings: non_d = tf.is_non_decreasing(t) non_decr.append(non_d) all_non_decr = tf.stack(non_decr) paddings = py_utils.with_dependencies([ tf.assert_equal( tf.reduce_any(tf.equal(paddings, 0.0)), True, message='must have at least one zero value.'), tf.assert_equal(all_non_decr, True, message='must be non-decreasing') ], paddings) return paddings
def test_tensor_with_one_element_is_non_decreasing(self): with self.test_session(): self.assertTrue(tf.is_non_decreasing([1]).eval())
def test_increasing_rank_two_tensor(self): with self.test_session(): self.assertTrue(tf.is_non_decreasing([[-1, 2], [3, 3]]).eval())
def test_increasing_rank_one_tensor_is_non_decreasing(self): with self.test_session(): self.assertTrue(tf.is_non_decreasing([1, 2, 3]).eval())
def test_2d_decreasing_tensor_is_not_non_decreasing(self): with self.test_session(): self.assertFalse(tf.is_non_decreasing([[1, 3], [2, 4]]).eval())
def test_decreasing_tensor_is_not_non_decreasing(self): with self.test_session(): self.assertFalse(tf.is_non_decreasing([3, 2, 1]).eval())
def test_constant_tensor_is_non_decreasing(self): with self.test_session(): self.assertTrue(tf.is_non_decreasing([1, 1, 1]).eval())
def execute_is_non_decreasing(self): return [tf.is_non_decreasing(self.vars[0], name="is_non_decreasing-" + str(self.node_num))]
def test_empty_tensor_is_non_decreasing(self): with self.test_session(): self.assertTrue(tf.is_non_decreasing([]).eval())
tf.ordered_map_clear() tf.ordered_map_incomplete_size() tf.ordered_map_peek() tf.ordered_map_size() tf.ordered_map_stage() tf.ordered_map_unstage() tf.ordered_map_unstage_no_key() tf.matrix_diag() tf.negative() tf.norm() tf.is_nan() tf.is_finite() tf.is_inf() tf.is_non_decreasing() tf.is_numeric_tensor() tf.is_strictly_increasing() tf.is_variable_initialized tf.global_variables_initializer() tf.global_variables() tf.global_norm() tf.local_variables() tf.local_variables_initializer() tf.get_local_variable tf.initialize_local_variables tf.equal() tf.einsum()