Instantly share code, notes, and snippets.

On research

Takuma Seno takuseno

View GitHub Profile
import numpy as np
import nnabla as nn
import nnabla.parametric_functions as PF
import nnabla.functions as F
import nnabla.solvers as S
import random
import argparse
import gym
import os
import cv2
from subprocess import Popen, PIPE
from xml.etree.ElementTree import fromstring
def main():
p = Popen(['nvidia-smi', '-q', '-x'], stdout=PIPE)
outs, errors = p.communicate()
xml = fromstring(outs)
num_gpus = int(xml.getiterator('attached_gpus')[0].text)
results = []
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
mode = 'maml'
seed = 0
plot = True
innerstepsize = 0.02 # stepsize in inner SGD
innerepochs = 1 # number of epochs of each inner SGD
outerstepsize0 = 0.1 if mode == 'reptile' else 0.001 # stepsize of outer optimization, i.e., meta-optimization