MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / benchmarkQROp

Method benchmarkQROp

tensorflow/python/kernel_tests/qr_op_test.py:244–273  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

242 ]
243
244 def benchmarkQROp(self):
245 for shape_ in self.shapes:
246 with ops.Graph().as_default(), \
247 session.Session(config=benchmark.benchmark_config()) as sess, \
248 ops.device("/cpu:0"):
249 matrix_value = np.random.uniform(
250 low=-1.0, high=1.0, size=shape_).astype(np.float32)
251 matrix = variables.Variable(matrix_value)
252 q, r = linalg_ops.qr(matrix)
253 variables.global_variables_initializer().run()
254 self.run_op_benchmark(
255 sess,
256 control_flow_ops.group(q, r),
257 min_iters=25,
258 name="QR_cpu_{shape}".format(shape=shape_))
259
260 if test.is_gpu_available(True):
261 with ops.Graph().as_default(), \
262 session.Session(config=benchmark.benchmark_config()) as sess, \
263 ops.device("/device:GPU:0"):
264 matrix_value = np.random.uniform(
265 low=-1.0, high=1.0, size=shape_).astype(np.float32)
266 matrix = variables.Variable(matrix_value)
267 q, r = linalg_ops.qr(matrix)
268 variables.global_variables_initializer().run()
269 self.run_op_benchmark(
270 sess,
271 control_flow_ops.group(q, r),
272 min_iters=25,
273 name="QR_gpu_{shape}".format(shape=shape_))
274
275
276if __name__ == "__main__":

Callers

nothing calls this directly

Calls 11

uniformMethod · 0.80
VariableMethod · 0.80
qrMethod · 0.80
run_op_benchmarkMethod · 0.80
as_defaultMethod · 0.45
GraphMethod · 0.45
SessionMethod · 0.45
deviceMethod · 0.45
runMethod · 0.45
groupMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected