Adds tnrs_infer_context function.