def test_find_operation_with_name(self): operation = all_operations.find_operation_with_name('tf.add(x, y)') self.assertEqual(operation.name, 'tf.add(x, y)') operation = all_operations.find_operation_with_name( 'tf.add(x, y)', operation_list=all_operations.get_tf_operations()) self.assertEqual(operation.name, 'tf.add(x, y)')
def test_get_tf_operations(self): operations = all_operations.get_tf_operations() self.assertLen(operations, len(tf_functions.TF_FUNCTIONS)) self.assertTrue( any(operation.name == 'tf.add(x, y)' for operation in operations)) self.assertFalse( any(operation.name == 'tf.sparse.add(a, b)' for operation in operations))
def print_supported_operations(): """Prints all of the supported operations.""" print('TensorFlow functions:\n' '---------------------') for operation in all_operations.get_tf_operations(): print(operation.name) print() print('SparseTensor functions:\n' '-----------------------') for operation in all_operations.get_sparse_operations(): print(operation.name) print() print('Python-syntax operations:\n' '-------------------------') for operation in all_operations.get_python_operations(): syntax_form = operation.reconstruct_expression_from_strings( ['arg{}'.format(i + 1) for i in range(operation.num_args)]) print('{:35} {}'.format(operation.name + ':', syntax_form))