


import os
import time

import numpy as np
import onnxruntime as ort


UpperCAmelCase      		=			'''1'''
UpperCAmelCase      		=			'''0'''
UpperCAmelCase      		=			'''1'''

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

UpperCAmelCase      		=			128
UpperCAmelCase      		=			1
UpperCAmelCase      		=			np.ones((batch, sequence), dtype=np.intaa)
UpperCAmelCase      		=			np.ones((batch, sequence), dtype=np.intaa)
UpperCAmelCase      		=			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...''')
UpperCAmelCase      		=			time.time()
UpperCAmelCase      		=			2_000
UpperCAmelCase      		=			{}
for iter in range(max_iters):
 UpperCAmelCase      		=			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"""



def       lowerCamelCase					(a_						:int)     ->							str:
       if number > 0:
              raise ValueError('''input must be a negative integer''')
       lowercase		:Any       							=				len(bin(a_)[3:])
       lowercase		:Any       							=				bin(abs(a_) - (1 << binary_number_length))[3:]
       lowercase		:Tuple       							=				(
           (
               '''1'''
               + '''0''' * (binary_number_length - len(a_))
               + twos_complement_number
           )
           if number < 0
           else '''0'''
       )
       return "0b" + twos_complement_number


if __name__ == "__main__":
 import doctest

 doctest.testmod()

