Integration test
How to locally test your Tensorleap integration
The purpose and structure of a local integration test
The integration test decorators
@tensorleap_load_model
import tensorflow as tf
from code_loader.inner_leap_binder.leapbinder_decorators import tensorleap_load_model, integration_test
#Define model outputs
prediction_type1 = PredictionTypeHandler('depth', ['high', 'low'], channel_dim=1)
#Load model
@tensorleap_load_model([prediction_type1])
def load_model():
dir_path = os.path.dirname(os.path.abspath(__file__))
model_path = 'models/GLPN_Kitti.onnx'
sess = onnxruntime.InferenceSession(os.path.join(dir_path, model_path))
return sess
#Instruct Tensorleap on how to infer model
@tensorleap_integration_test()
def integration_test(idx, subset):
sess = load_model()
# inputs
x = input_image(idx, subset)
# model
input_name_1 = sess.get_inputs()[0].name
pred = sess.run(None, {input_name_1: x})[0]
...@tensorleap_integration_test
An integration test example
Last updated
Was this helpful?

