def flags(enabled=False): with __allow_nonbracketed_mutation(): orig_flags = set_flags(enabled) try: yield finally: with __allow_nonbracketed_mutation(): set_flags(orig_flags[0])
def flags(enabled=False, benchmark=False, deterministic=False, allow_tf32=True): with __allow_nonbracketed_mutation(): orig_flags = set_flags(enabled, benchmark, deterministic, allow_tf32) try: yield finally: # recover the previous values with __allow_nonbracketed_mutation(): set_flags(*orig_flags)
def flags(enabled=False, benchmark=False, deterministic=False, verbose=False): with __allow_nonbracketed_mutation(): orig_flags = set_flags(enabled, benchmark, deterministic, verbose) try: yield finally: # recover the previous values with __allow_nonbracketed_mutation(): set_flags(orig_flags[0], orig_flags[1], orig_flags[2], orig_flags[3])
def flags(enabled=False, benchmark=False, deterministic=False, allow_tf32=True, conv_fwd_algo=-1): #<AliJahan> with __allow_nonbracketed_mutation(): orig_flags = set_flags(enabled, benchmark, deterministic, allow_tf32, conv_fwd_algo) try: yield finally: # recover the previous values with __allow_nonbracketed_mutation(): set_flags(*orig_flags)