Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
'''
Run the script, then paste a "python-like" dictionary as input and press enter.
The script will output the json parseable version of the input.
'''
import json
import ast
def transform(obj):
# Gist for discussion: https://github.com/fchollet/keras/pull/8592#discussion_r153287881
# OPTION 1 - replace list comprehension with for loop:
def func_load(code, defaults=None, closure=None, globs=None):
"""Deserializes a user defined function.
# Arguments
code: bytecode of the function.
@rh314
rh314 / A_zmq-pytorch-segfault-2017-08-21.txt
Last active August 21, 2017 20:38
Container setup to reproduce zmq + pytorch segfault
See Dockerfile and run-stuff.sh
@rh314
rh314 / variational_optimisation.py
Last active May 31, 2022 15:55 — forked from davidbarber/E.m
Variational Optimisation
# Python version of: https://gist.github.com/davidbarber/16708b9135f13c9599f754f4010a0284
# as per blog post: https://davidbarber.github.io/blog/2017/04/03/variational-optimisation/
# also see https://www.reddit.com/r/MachineLearning/comments/63dhfc/r_evolutionary_optimization_as_a_variational/
from __future__ import print_function
import matplotlib
matplotlib.use('Agg')