import os
import time

import numpy as np
import onnxruntime as ort


_lowerCAmelCase       =		'''1'''
_lowerCAmelCase       =		'''0'''
_lowerCAmelCase       =		'''1'''

_lowerCAmelCase       =		ort.SessionOptions()
_lowerCAmelCase       =		ort.GraphOptimizationLevel.ORT_DISABLE_ALL
print("Create inference session...")
_lowerCAmelCase       =		['''TensorrtExecutionProvider''', '''CUDAExecutionProvider''']
_lowerCAmelCase       =		ort.InferenceSession("model.onnx", sess_options=sess_opt, providers=execution_provider)
_lowerCAmelCase       =		ort.RunOptions()

_lowerCAmelCase       =		128
_lowerCAmelCase       =		1
_lowerCAmelCase       =		np.ones((batch, sequence), dtype=np.intaa)
_lowerCAmelCase       =		np.ones((batch, sequence), dtype=np.intaa)
_lowerCAmelCase       =		np.ones((batch, sequence), dtype=np.intaa)

print("Warm up phase...")
sess.run(
    None,
    {
        sess.get_inputs()[0].name: input_ids,
        sess.get_inputs()[1].name: attention_mask,
        sess.get_inputs()[2].name: token_type_ids,
    },
    run_options=run_opt,
)

print("Start inference...")
_lowerCAmelCase       =		time.time()
_lowerCAmelCase       =		2_000
_lowerCAmelCase       =		{}
for iter in range(max_iters):
					_lowerCAmelCase       =		sess.run(
					    None,
					    {
					        sess.get_inputs()[0].name: input_ids,
					        sess.get_inputs()[1].name: attention_mask,
					        sess.get_inputs()[2].name: token_type_ids,
					    },
					    run_options=run_opt,
					)
print("Average Inference Time = {:.3f} ms".format((time.time() - start_time) * 1_000 / max_iters))







'''simple docstring'''




from math import loga




def 						__lowerCamelCase			(	UpperCAmelCase_							)   ->int:
	if a < 0:
		raise ValueError('Input value must be a positive integer'							)
	elif isinstance(UpperCAmelCase_					,				UpperCAmelCase_							):
		raise TypeError('Input value must be a \'int\' type'							)
	return 0 if (a == 0) else int(loga(a & -a							)							)


if __name__ == "__main__":
			import doctest

			doctest.testmod()



