(gpu_fraction=0.2)
| 31 | maxlabellength = 2 |
| 32 | |
| 33 | def get_session(gpu_fraction=0.2): |
| 34 | |
| 35 | num_threads = os.environ.get('OMP_NUM_THREADS') |
| 36 | gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=gpu_fraction,allow_growth = True) |
| 37 | |
| 38 | if num_threads: |
| 39 | return tf.Session(config=tf.ConfigProto( |
| 40 | gpu_options=gpu_options, intra_op_parallelism_threads=num_threads)) |
| 41 | else: |
| 42 | return tf.Session(config=tf.ConfigProto(gpu_options=gpu_options)) |
| 43 | |
| 44 | def readfile(filename): |
| 45 | res = [] |