in c2/lib/utils/model_helper.py [0:0]
def getTrainingGPUs(path, dbtype):
'''
well, turns out that SaveModel savs the vars with the gpu_X/ prefix...
this function returns the GPUs used during training.
'''
meta_net_def = pred_exp.load_from_db(path, dbtype)
gpus = set()
def is_number(s):
try:
float(s)
return True
except ValueError:
return False
for kv in meta_net_def.nets:
net = kv.value
for op in net.op:
if op.input and op.output:
thisgpu = op.input[-1].split('/')[0].split('_')[-1]
if is_number(thisgpu):
gpus.add(thisgpu)
return gpus