Add benchmark for no-op convert of an EagerTensor
PiperOrigin-RevId: 313669416 Change-Id: I82fe1ad6bda97a6a69c8f0d69192d762d53d2034
This commit is contained in:
parent
4e4a4496b7
commit
f27bc524dd
@ -1231,6 +1231,14 @@ class MicroBenchmarks(benchmarks_test_base.MicroBenchmarksBase):
|
|||||||
|
|
||||||
self._run(fn, 10000)
|
self._run(fn, 10000)
|
||||||
|
|
||||||
|
def benchmark_convert_tensor(self):
|
||||||
|
value = ops.convert_to_tensor(42)
|
||||||
|
|
||||||
|
def fn():
|
||||||
|
return ops.convert_to_tensor(value)
|
||||||
|
|
||||||
|
self._run(fn, 10000)
|
||||||
|
|
||||||
def _benchmark_convert_constant(self, value, cached):
|
def _benchmark_convert_constant(self, value, cached):
|
||||||
global GLOBAL_TEST_VALUE
|
global GLOBAL_TEST_VALUE
|
||||||
GLOBAL_TEST_VALUE = value
|
GLOBAL_TEST_VALUE = value
|
||||||
|
Loading…
Reference in New Issue
Block a user