Getting Setup: Follow the instruction on https://gym.openai.com/docs
git clone https://github.com/openai/gym
cd gym
pip install -e . # minimal install
Basic Example using CartPole-v0:
#!/usr/bin/env python | |
# coding=utf-8 | |
import numpy as np | |
""" | |
1: Procedure Policy_Iteration(S,A,P,R) | |
2: Inputs | |
3: S is the set of all states | |
4: A is the set of all actions | |
5: P is state transition function specifying P(s'|s,a) |
Getting Setup: Follow the instruction on https://gym.openai.com/docs
git clone https://github.com/openai/gym
cd gym
pip install -e . # minimal install
Basic Example using CartPole-v0:
class iter_shuffle_batch_tensors(Iterator): | |
"""Combine `iter_tensors_slice` and `iter_shuffle_batch_range`. | |
Args: | |
See `iter_tensors_slice` and `iter_shuffle_batch_range`. | |
Output: | |
See `iter_shuffle_batch_range`. | |
""" |
"""Script to illustrate usage of tf.estimator.Estimator in TF v1.3""" | |
import tensorflow as tf | |
from tensorflow.examples.tutorials.mnist import input_data as mnist_data | |
from tensorflow.contrib import slim | |
from tensorflow.contrib.learn import ModeKeys | |
from tensorflow.contrib.learn import learn_runner | |
# Show debugging output |
import numpy as np | |
import os | |
class NeuralNetwork: | |
def __init__(self): | |
# Our training data | |
self.X = np.array([[0, 0, 1], [1, 1, 1], [1, 0, 1], [0, 1, 1]]) | |
self.y = np.transpose(np.array([[0, 1, 1, 1]])) | |
# Seed random number generator to produce the same |
import tensorflow as tf | |
import numpy as np | |
from google.protobuf import json_format | |
import json | |
np.random.seed(12345) | |
def tensorflow_get_weights(): | |
""" |
#!/bin/bash | |
### steps #### | |
# Verify the system has a cuda-capable gpu | |
# Download and install the nvidia cuda toolkit and cudnn | |
# Setup environmental variables | |
# Verify the installation | |
### | |
### to verify your gpu is cuda enable check |
In the following gist I'm going to guide you through the process of installing and booting an entire linux distribution with full desktop environment just like you would have with a classical VM, but with much better performance and much worse isolation :)
The reason why I did this was mainly because it's cool, but also to test new distros with decent graphics performance without actually booting them on my PC.
If you "try this at home" just keep in mind a container is not as secure as a VM, and some of the option we're going to explore will weaken container isolation from "a bit risky" to "totally unsafe" depending on what you choose.
Also, we're going to use systemd-nspawn for containers as it's probably the best fit for our use case and can also boot any linux partition without needing to prepare an apposite container image.
Less go!