Skip to content

Instantly share code, notes, and snippets.

View pekaalto's full-sized avatar

pekaalto

View GitHub Profile
@pekaalto
pekaalto / sc2vecenv.py
Last active October 26, 2017 06:40
Just editing baselines subprocvecenv for sc2
"""
Almost direct copy from https://github.com/openai/baselines/blob/master/baselines/common/vec_env/subproc_vec_env.py
"""
from multiprocessing import Process, Pipe
from pysc2.env import sc2_env, available_actions_printer
def worker(remote, env_fn_wrapper):
"""
@pekaalto
pekaalto / embeddings_and_convs.py
Last active August 19, 2018 03:09
Example of two equivalent methods of embedding categorical features on channel dimension
"""
Pekka Aalto 2017
This snippet tries to explain by example what deepmind means
in https://arxiv.org/abs/1708.04782
about embedding on channel axis being equivalent to
one-hot-encoding followed by 1x1 conv.
They write:
@pekaalto
pekaalto / keraslstm.py
Created January 9, 2020 05:37
Investigate keras-lstm inputs, outputs and weights.
"""
Investigate keras-lstm inputs, outputs and weights.
Needs tensorflow 2.0
Note: The explanation of weights matches the CPU-implementation of LSTM-layer.
In GPU-implementation the weights are organized slightly differently
"""
import numpy as np
import tensorflow as tf