(job)
Run a torch based job.
Run a torch based job.
Run a torch based job .
def run_torch_job(job):
    '''Run a torch based job.'''

    params = {}
    for param in job.param:
        dbl_vals = param.dbl_val._values
        int_vals = param.int_val._values
        str_vals = param.str_val._values

        if len(dbl_vals) > 0:
            params[param.name] = dbl_vals
        elif len(int_vals) > 0:
            params[param.name] = int_vals
        elif len(str_vals) > 0:
            params[param.name] = str_vals
        else:
            raise Exception("Unknown parameter type.")

    #TODO: this passes args correctly for experiment utils, but we need to
    # figure out how to get the result back out when the experiment completes.

    param_str = ""
    for pname, pval in params.iteritems():
        if len(pval) == 1:
            pval = str(pval[0])
        else:
            pval = ','.join([str(v) for v in pval])

        param_str += "-" + pname + " " + pval + " "

    cmd = "./%s %s" % (job.name, param_str)
    log("Executing command: %s\n" % (cmd))
    sh(cmd)
def run_torch_job ( job ) : params = { } for param in job . param : dbl_vals = param . dbl_val . _values int_vals = param . int_val . _values str_vals = param . str_val . _values if len ( dbl_vals ) > 0 : params [ param . name ] = dbl_vals elif len ( int_vals ) > 0 : params [ param . name ] = int_vals elif len ( str_vals ) > 0 : params [ param . name ] = str_vals else : raise Exception ( "Unknown parameter type." ) #TODO: this passes args correctly for experiment utils, but we need to # figure out how to get the result back out when the experiment completes. param_str = "" for pname , pval in params . iteritems ( ) : if len ( pval ) == 1 : pval = str ( pval [ 0 ] ) else : pval = ',' . join ( [ str ( v ) for v in pval ] ) param_str += "-" + pname + " " + pval + " " cmd = "./%s %s" % ( job . name , param_str ) log ( "Executing command: %s\n" % ( cmd ) ) sh ( cmd )