mirror of
https://github.com/vale981/ray
synced 2025-03-09 04:46:38 -04:00

* Initializing A3C code * Modifications for Ray usage * cleanup * removing universe dependency * fixes (not yet working * hack * documentation * Cleanup * Preliminary Portion Make sure to change when merging * RL part * Cleaning up Driver and Worker code * Updating driver code * instructions... * fixed * Minor changes. * Fixing cmake issues * ray instruction * updating port to new universe * Fix for env.configure * redundant commands * Revert scipy.misc -> cv2 and raise exception for wrong gym version.
26 lines
641 B
Python
26 lines
641 B
Python
from __future__ import absolute_import
|
|
from __future__ import division
|
|
from __future__ import print_function
|
|
|
|
import numpy as np
|
|
from datetime import datetime
|
|
import cProfile, pstats, io
|
|
|
|
def timestamp():
|
|
return datetime.now().timestamp()
|
|
|
|
class Profiler(object):
|
|
def __init__(self):
|
|
self.pr = cProfile.Profile()
|
|
pass
|
|
|
|
def __enter__(self):
|
|
self.pr.enable()
|
|
|
|
def __exit__(self ,type, value, traceback):
|
|
self.pr.disable()
|
|
s = io.StringIO()
|
|
sortby = 'cumtime'
|
|
ps = pstats.Stats(self.pr, stream=s).sort_stats(sortby)
|
|
ps.print_stats(.2)
|
|
print(s.getvalue())
|