def post(self, run_name, group, tag): x = json_to_nd(request.json) run = resolve_run(run_name) tag_name = group + "/" + tag p = "histogram/" + tag_name run["writer"].add_histogram(tag_name, x, get_step(run_name, p)) increment_step(run_name, p)
def do_run(dim, method): r = create_r(dim) r = nd_to_json(r, method) r = json.dumps(r) r = json.loads(r) #now decode r = json_to_nd(r, method)
def post(self, run_name, group, tag, format="hwc"): x = json_to_nd(request.json) run = resolve_run(run_name) format = format.upper() tag_name = group + "/" + tag p = "image/" + tag_name #write and increment step run["writer"].add_image(tag_name, x, get_step(run_name, p), dataformats=format) increment_step(run_name, p)
def post(self, run_name, group, tag, samplerate=44100): x = json_to_nd(request.json) run = resolve_run(run_name) samplerate = int(samplerate) tag_name = group + "/" + tag p = "audio/" + tag_name #write and increment step run["writer"].add_audio(tag_name, x, get_step(run_name, p), sample_rate=samplerate) increment_step(run_name, p)
def post(self, key): r = request.get_json(force=True) r = json_to_nd(r) shape = r.shape shape = [int(x) for x in shape] #create mapping mapping = create_mapping(key, shape, esn.state.shape) #add values esn.state[mapping] += r.flatten()
def pp_step(data): #get observation from data and store for .step later self.observation = json_to_nd(data) #set update event self.update_event.set() #wait for step to be ready self.flask_wait.wait() self.flask_wait.clear() return nd_to_json(self.action)
def post(self, run_name, group, tag, fps=15): x = json_to_nd(request.json) run = resolve_run(run_name) format = format.upper() fps = int(fps) tag_name = group + "/" + tag p = "video/" + tag_name #write and increment step run["writer"].add_image(tag_name, x, get_step(run_name, p), fps=fps) increment_step(run_name, p)
def step(data): global obs #get action action = json_to_nd(data) if is_discrete: action = int(action) #step environment obs, reward, done, info = env.step(action) done = bool(done) reward = float(reward) if done: obs = env.reset() reward += EPISODE_REWARD #TODO: fix info (recursively check that each value is json serializable) return {"obs": nd_to_json(obs), "done": done, "reward": reward, "info": {}}