




import os
import time

import numpy as np
import onnxruntime as ort


_lowerCamelCase      :  Any      						=						"1"
_lowerCamelCase      :  str      						=						"0"
_lowerCamelCase      :  Tuple      						=						"1"

_lowerCamelCase      :  str      						=						ort.SessionOptions()
_lowerCamelCase      :  Dict      						=						ort.GraphOptimizationLevel.ORT_DISABLE_ALL
print("Create inference session...")
_lowerCamelCase      :  str      						=						["TensorrtExecutionProvider", "CUDAExecutionProvider"]
_lowerCamelCase      :  Dict      						=						ort.InferenceSession("model.onnx", sess_options=sess_opt, providers=execution_provider)
_lowerCamelCase      :  Any      						=						ort.RunOptions()

_lowerCamelCase      :  Tuple      						=						1_2_8
_lowerCamelCase      :  Tuple      						=						1
_lowerCamelCase      :  Tuple      						=						np.ones((batch, sequence), dtype=np.intaa)
_lowerCamelCase      :  List[str]      						=						np.ones((batch, sequence), dtype=np.intaa)
_lowerCamelCase      :  Optional[Any]      						=						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      :  Optional[int]      						=						time.time()
_lowerCamelCase      :  Any      						=						2_0_0_0
_lowerCamelCase      :  Optional[Any]      						=						{}
for iter in range(max_iters):
	_lowerCamelCase      :  Dict      						=						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_0_0_0 / max_iters))







def 							_UpperCAmelCase  (UpperCamelCase_ : int       ):
				'''simple docstring'''
				_lowerCAmelCase    :    int										=      n ** (1 / 3)
				return (val * val * val) == n


if __name__ == "__main__":
	print(perfect_cube(2_7))
	print(perfect_cube(4))

