Skip to content

Commit baa65a8

Browse files
Removing benchmarks. (#1290)
1 parent 9303f08 commit baa65a8

File tree

3 files changed

+0
-99
lines changed

3 files changed

+0
-99
lines changed

tensorflow_addons/activations/BUILD

-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ py_test(
124124
srcs = [
125125
"rrelu_test.py",
126126
],
127-
args = ["--benchmarks=all"],
128127
main = "rrelu_test.py",
129128
deps = [
130129
":activations",

tensorflow_addons/activations/rrelu_test.py

-10
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,5 @@ def inner(x):
8282
)
8383

8484

85-
# TODO: Benchmark fails for windows builds #839
86-
# class RreluBenchmarks(tf.test.Benchmark):
87-
# def benchmarkRreluOp(self):
88-
# with tf.compat.v1.Session(config=tf.test.benchmark_config()) as sess:
89-
# x = tf.constant([-2.0, -1.0, 0.0, 1.0, 2.0], dtype=np.float32)
90-
# lower = 0.1
91-
# upper = 0.2
92-
# result = rrelu(x, lower, upper, training=True)
93-
# self.run_op_benchmark(sess, result.op, min_iters=25)
94-
9585
if __name__ == "__main__":
9686
sys.exit(pytest.main([__file__]))

tensorflow_addons/image/distort_image_ops_test.py

-88
Original file line numberDiff line numberDiff line change
@@ -292,93 +292,5 @@ def test_invalid_channels(self):
292292
self.evaluate(self._adjust_saturation_in_yiq_tf(x_np, scale))
293293

294294

295-
# TODO: get rid of sessions
296-
class AdjustHueInYiqBenchmark(tf.test.Benchmark):
297-
def _benchmark_adjust_hue_in_yiq(self, device, cpu_count):
298-
image_shape = [299, 299, 3]
299-
burn_iters = 100
300-
benchmark_iters = 1000
301-
config = tf.compat.v1.ConfigProto()
302-
tag = device + "_%s" % (cpu_count if cpu_count is not None else "all")
303-
if cpu_count is not None:
304-
config.inter_op_parallelism_threads = 1
305-
config.intra_op_parallelism_threads = cpu_count
306-
with self.cached_session("", graph=tf.Graph(), config=config) as sess:
307-
with tf.device(device):
308-
inputs = tf.Variable(
309-
tf.random.uniform(image_shape, dtype=tf.dtypes.float32) * 255,
310-
trainable=False,
311-
dtype=tf.dtypes.float32,
312-
)
313-
delta = tf.constant(0.1, dtype=tf.dtypes.float32)
314-
outputs = distort_image_ops.adjust_hsv_in_yiq(inputs, delta, 1, 1)
315-
run_op = tf.group(outputs)
316-
sess.run(tf.compat.v1.global_variables_initializer())
317-
benchmark_values = self.run_op_benchmark(
318-
sess,
319-
run_op,
320-
burn_iters=burn_iters,
321-
min_iters=benchmark_iters,
322-
name="benchmarkAdjustSaturationInYiq_299_299_3_%s" % (tag),
323-
)
324-
print(
325-
"benchmarkAdjustSaturationInYiq_299_299_3_%s step_time: %.2f us"
326-
% (tag, benchmark_values["wall_time"] * 1e6)
327-
)
328-
329-
def benchmark_adjust_hue_in_yiqCpu1(self):
330-
self._benchmark_adjust_hue_in_yiq("/cpu:0", 1)
331-
332-
def benchmark_adjust_hue_in_yiqCpuAll(self):
333-
self._benchmark_adjust_hue_in_yiq("/cpu:0", None)
334-
335-
def benchmark_adjust_hue_in_yiq_gpu_all(self):
336-
self._benchmark_adjust_hue_in_yiq(tf.test.gpu_device_name(), None)
337-
338-
339-
# TODO: get rid of sessions
340-
class AdjustSaturationInYiqBenchmark(tf.test.Benchmark):
341-
def _benchmark_adjust_saturation_in_yiq(self, device, cpu_count):
342-
image_shape = [299, 299, 3]
343-
burn_iters = 100
344-
benchmark_iters = 1000
345-
config = tf.compat.v1.ConfigProto()
346-
tag = device + "_%s" % (cpu_count if cpu_count is not None else "all")
347-
if cpu_count is not None:
348-
config.inter_op_parallelism_threads = 1
349-
config.intra_op_parallelism_threads = cpu_count
350-
with self.cached_session("", graph=tf.Graph(), config=config) as sess:
351-
with tf.device(device):
352-
inputs = tf.Variable(
353-
tf.random.uniform(image_shape, dtype=tf.dtypes.float32) * 255,
354-
trainable=False,
355-
dtype=tf.dtypes.float32,
356-
)
357-
scale = tf.constant(0.1, dtype=tf.dtypes.float32)
358-
outputs = distort_image_ops.adjust_hsv_in_yiq(inputs, 0, scale, 1)
359-
run_op = tf.group(outputs)
360-
sess.run(tf.compat.v1.global_variables_initializer())
361-
benchmark_values = self.run_op_benchmark(
362-
sess,
363-
run_op,
364-
burn_iters=burn_iters,
365-
min_iters=benchmark_iters,
366-
name="benchmarkAdjustSaturationInYiq_299_299_3_%s" % (tag),
367-
)
368-
print(
369-
"benchmarkAdjustSaturationInYiq_299_299_3_%s step_time: %.2f us"
370-
% (tag, benchmark_values["wall_time"] * 1e6)
371-
)
372-
373-
def benchmark_adjust_saturation_in_yiq_cpu1(self):
374-
self._benchmark_adjust_saturation_in_yiq("/cpu:0", 1)
375-
376-
def benchmark_adjust_saturation_in_yiq_cpu_all(self):
377-
self._benchmark_adjust_saturation_in_yiq("/cpu:0", None)
378-
379-
def benchmark_adjust_saturation_in_yiq_gpu_all(self):
380-
self._benchmark_adjust_saturation_in_yiq(tf.test.gpu_device_name(), None)
381-
382-
383295
if __name__ == "__main__":
384296
sys.exit(pytest.main([__file__]))

0 commit comments

Comments
 (0)