Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class MemoryEnv: | |
| # Max return per episode: 17. | |
| def __init__(self): | |
| self.q = [] | |
| def reset(self): | |
| del self.q[:] | |
| self.obs = torch.randn(4) | |
| self.q.append(self.obs) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class HardCartPole: | |
| def __init__(self): | |
| self._env = gym.make("CartPole-v0") | |
| self._reward = 0.0 | |
| def reset(self): | |
| self._reward = 0.0 | |
| return self._env.reset() | |
| def step(self, action): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| BRIGHT = 8 | |
| def color(s, fg, bg): | |
| return "\033[%d;3%d;4%dm%s\033[0m" % ( | |
| bool(fg & BRIGHT), | |
| fg & ~BRIGHT, | |
| bg & ~BRIGHT, | |
| s, | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [1/3] Linking CXX shared module moolib.cpython-38-x86_64-linux-gnu.so | |
| FAILED: moolib.cpython-38-x86_64-linux-gnu.so | |
| : && /usr/bin/c++ -fPIC -Wfatal-errors -march=native -ftemplate-backtrace-limit=0 -Bsymbolic -D_GLIBCXX_USE_CXX11_ABI=0 -flto -shared -o moolib.cpython-38-x86_64-linux-gnu.so CMakeFiles/moolib.dir/src/moolib.cc.o -Wl,-rpath,/private/home/hnr/.conda/envs/nle2021/lib/python3.8/site-packages/torch/lib:/public/apps/cuda/10.1/lib64:/public/apps/cudnn/v7.6.5.32-cuda.10.1/cuda/lib64:/public/apps/cuda/10.1/lib64/stubs libmoorpc.a /private/home/hnr/.conda/envs/nle2021/lib/python3.8/site-packages/torch/lib/libtorch_python.so src/fmt/libfmt.a src/tensorpipe/tensorpipe/libtensorpipe.a src/tensorpipe/tensorpipe/libtensorpipe_uv.a -lpthread -ldl -lrt /private/home/hnr/.conda/envs/nle2021/lib/python3.8/site-packages/torch/lib/libtorch.so -Wl,--no-as-needed,/private/home/hnr/.conda/envs/nle2021/lib/python3.8/site-packages/torch/lib/libtorch_cpu.so -Wl,--as-needed -lpthread -Wl,--no-as-needed,/pr |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import collections | |
| import re | |
| import sys | |
| ifs = ["#ifndef", "#ifdef", "#if"] | |
| SLASHAST = re.compile(r"/\*.*?\*/", re.DOTALL) | |
| DOUBLESLASH = re.compile(r"//.*?\n") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cmake_minimum_required(VERSION 3.10) | |
| project(dlreload) | |
| add_library(inner SHARED inner.c) | |
| add_library(outer SHARED outer.c) | |
| add_executable(test test.c) | |
| target_link_libraries(test PUBLIC outer) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # pytest -svx welford_test.py | |
| # | |
| """ | |
| Cf. Sutton-Barto | |
| http://www.incompleteideas.net/book/first/ebook/node19.html | |
| and | |
| https://math.stackexchange.com/a/103025/5051 | |
| as well as | |
| https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Parallel_algorithm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Essentials ########################################################### | |
| unbind C-b | |
| set -g prefix C-q | |
| # Reload config | |
| bind R source-file ~/.tmux.conf \; display-message "Tmux configuration reloaded" | |
| # Basic terminal defaults | |
| setw -g mode-keys vi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cmake_minimum_required(VERSION 3.10) | |
| project(cppgen VERSION 0.0.1 LANGUAGES CXX) | |
| set(CMAKE_CXX_STANDARD 11) | |
| set(CMAKE_CXX_STANDARD_REQUIRED ON) | |
| add_executable(remapping remapping.cc) | |
| target_link_libraries(remapping stdc++ "-framework Foundation" "-framework IOKit" objc) |