This file contains 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
from __future__ import division | |
import matplotlib.pyplot as plt | |
import numpy as np | |
import zlib | |
def generate_const_image_bw(nx, ny): | |
im = np.zeros((nx, ny), dtype='uint8') | |
return im | |
def generate_checkerboard_image_bw(nx, ny): |
This file contains 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
#pele and PyCG_DESCENT need to be installed and added to the pythonpath | |
import numpy as np | |
from pele.potentials import BasePotential | |
from PyCG_DESCENT import CGDescent | |
class squareFunc(BasePotential): | |
# this is the only method that you actually need to implement | |
def getEnergy(self, x): | |
val = x[0]**2 + x[1]**2 | |
return val |
This file contains 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
from __future__ import division | |
import numpy as np | |
import tensorflow as tf | |
from tensorflow.examples.tutorials.mnist import input_data | |
def select_device_simple(dev="cpu"): | |
if dev.lower() == "cpu": | |
return "/cpu:0" | |
elif dev.lower() == 'gpu': | |
return "/gpu:0" |