Python tensorflow.compat.v1.disable_eager_execution() Examples
The following are 30
code examples of tensorflow.compat.v1.disable_eager_execution().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
tensorflow.compat.v1
, or try the search function
.
Example #1
Source File: eval_utils_test.py From text-to-text-transfer-transformer with Apache License 2.0 | 6 votes |
def test_parse_events_files(self): tb_summary_dir = self.create_tempdir() tf.disable_eager_execution() # Needed in pytest. summary_writer = tf.summary.FileWriter(tb_summary_dir.full_path) tags = [ "eval/foo_task/accuracy", "eval/foo_task/accuracy", "loss", ] values = [1., 2., 3.] steps = [20, 30, 40] for tag, value, step in zip(tags, values, steps): summary = tf.Summary() summary.value.add(tag=tag, simple_value=value) summary_writer.add_summary(summary, step) summary_writer.flush() events = eval_utils.parse_events_files(tb_summary_dir.full_path) self.assertDictEqual( events, { "eval/foo_task/accuracy": [(20, 1.), (30, 2.)], "loss": [(40, 3.)], }, )
Example #2
Source File: onnx.py From utensor_cgen with Apache License 2.0 | 6 votes |
def parse(self, onnx_file, output_nodes=None, model_name=None): tf.disable_eager_execution() if model_name: graph_name = model_name else: graph_name, _ = os.path.splitext( os.path.basename(onnx_file) ) tf.reset_default_graph() model = onnx.load(onnx_file) onnx_graph = model.graph ugraph = uTensorGraph( name=graph_name, output_nodes=[], lib_name='onnx', ops_info={}, ) self._build_graph(onnx_graph, ugraph) ugraph = Legalizer.legalize(ugraph) tf.reset_default_graph() return ugraph
Example #3
Source File: training_test.py From tf-slim with Apache License 2.0 | 5 votes |
def setUpModule(): tf.disable_eager_execution()
Example #4
Source File: test_forward.py From incubator-tvm with Apache License 2.0 | 5 votes |
def test_forward_atan2(): """test operator tan """ tf.disable_eager_execution() np_data_1 = np.random.uniform(1, 100, size=(2, 3, 5)).astype(np.float32) np_data_2 = np.random.uniform(1, 100, size=(2, 3, 5)).astype(np.float32) tf.reset_default_graph() in_data_1 = tf.placeholder(tf.float32, (2, 3, 5), name="in_data_1") in_data_2 = tf.placeholder(tf.float32, (2, 3, 5), name="in_data_2") tf.atan2(in_data_1, in_data_2, name="atan2") compare_tf_with_tvm([np_data_1, np_data_2], ['in_data_1:0', 'in_data_2:0'], 'atan2:0')
Example #5
Source File: pcgrad_tpu_test.py From tensor2robot with Apache License 2.0 | 5 votes |
def testPCgradNetworkTPU(self): tf.reset_default_graph() tf.disable_eager_execution() learning_rate = lambda: 0.001 def pcgrad_computation(): x = tf.constant(1., shape=[64, 472, 472, 3]) layers = [ tf.keras.layers.Conv2D(filters=64, kernel_size=3), tf.keras.layers.Conv2D(filters=32, kernel_size=3, strides=(2, 2)), tf.keras.layers.Conv2D(filters=32, kernel_size=3, strides=(2, 2)), tf.keras.layers.Conv2D(filters=32, kernel_size=3, strides=(2, 2)), tf.keras.layers.Conv2D(filters=32, kernel_size=3, strides=(2, 2)), ] y = x for layer in layers: y = layer(y) n_tasks = 10 task_loss_0 = tf.reduce_sum(y) task_losses = [task_loss_0 * (1. + (n / 10.)) for n in range(n_tasks)] pcgrad_opt = pcgrad.PCGrad( tf.train.GradientDescentOptimizer(learning_rate)) pcgrad_grads_and_vars = pcgrad_opt.compute_gradients( task_losses, var_list=tf.trainable_variables()) return pcgrad_opt.apply_gradients(pcgrad_grads_and_vars) tpu_computation = tf.compat.v1.tpu.batch_parallel(pcgrad_computation, num_shards=2) self.evaluate(tf.compat.v1.tpu.initialize_system()) self.evaluate(tf.compat.v1.global_variables_initializer()) self.evaluate(tpu_computation) self.evaluate(tf.compat.v1.tpu.shutdown_system())
Example #6
Source File: loss_ops_test.py From tf-slim with Apache License 2.0 | 5 votes |
def setUpModule(): tf.disable_eager_execution()
Example #7
Source File: metric_learning_test.py From tf-slim with Apache License 2.0 | 5 votes |
def setUpModule(): tf.disable_eager_execution()
Example #8
Source File: learning_test.py From tf-slim with Apache License 2.0 | 5 votes |
def setUpModule(): tf.disable_eager_execution()
Example #9
Source File: summaries_test.py From tf-slim with Apache License 2.0 | 5 votes |
def setUpModule(): tf.disable_eager_execution()
Example #10
Source File: layers_test.py From tf-slim with Apache License 2.0 | 5 votes |
def setUpModule(): tf.disable_eager_execution()
Example #11
Source File: rev_block_lib_test.py From tf-slim with Apache License 2.0 | 5 votes |
def setUpModule(): tf.disable_eager_execution()
Example #12
Source File: sparse_ops_test.py From tf-slim with Apache License 2.0 | 5 votes |
def setUpModule(): tf.disable_eager_execution()
Example #13
Source File: normalization_test.py From tf-slim with Apache License 2.0 | 5 votes |
def setUpModule(): tf.disable_eager_execution()
Example #14
Source File: regularizers_test.py From tf-slim with Apache License 2.0 | 5 votes |
def setUpModule(): tf.disable_eager_execution()
Example #15
Source File: utils_test.py From tf-slim with Apache License 2.0 | 5 votes |
def setUpModule(): tf.disable_eager_execution()
Example #16
Source File: resnet_v2_test.py From tf-slim with Apache License 2.0 | 5 votes |
def setUpModule(): tf.disable_eager_execution()
Example #17
Source File: evaluation_test.py From tf-slim with Apache License 2.0 | 5 votes |
def setUpModule(): tf.disable_eager_execution()
Example #18
Source File: framework_ops_test.py From tf-slim with Apache License 2.0 | 5 votes |
def setUpModule(): tf.disable_eager_execution()
Example #19
Source File: evaluation_test.py From tf-slim with Apache License 2.0 | 5 votes |
def setUpModule(): tf.disable_eager_execution()
Example #20
Source File: dataset_data_provider_test.py From tf-slim with Apache License 2.0 | 5 votes |
def setUpModule(): tf.disable_eager_execution()
Example #21
Source File: tfexample_decoder_test.py From tf-slim with Apache License 2.0 | 5 votes |
def setUpModule(): tf.disable_eager_execution()
Example #22
Source File: prefetch_queue_test.py From tf-slim with Apache License 2.0 | 5 votes |
def setUpModule(): tf.disable_eager_execution()
Example #23
Source File: classification_test.py From tf-slim with Apache License 2.0 | 5 votes |
def setUpModule(): tf.disable_eager_execution()
Example #24
Source File: histogram_ops_test.py From tf-slim with Apache License 2.0 | 5 votes |
def setUpModule(): tf.disable_eager_execution()
Example #25
Source File: metric_ops_large_test.py From tf-slim with Apache License 2.0 | 5 votes |
def setUpModule(): tf.disable_eager_execution()
Example #26
Source File: inception_v1_test.py From tf-slim with Apache License 2.0 | 5 votes |
def setUpModule(): tf.disable_eager_execution()
Example #27
Source File: inception_v3_test.py From tf-slim with Apache License 2.0 | 5 votes |
def setUpModule(): tf.disable_eager_execution()
Example #28
Source File: vgg_test.py From tf-slim with Apache License 2.0 | 5 votes |
def setUpModule(): tf.disable_eager_execution()
Example #29
Source File: resnet_v1_test.py From tf-slim with Apache License 2.0 | 5 votes |
def setUpModule(): tf.disable_eager_execution()
Example #30
Source File: alexnet_test.py From tf-slim with Apache License 2.0 | 5 votes |
def setUpModule(): tf.disable_eager_execution()