Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 tensorflow.python.eager import def_function | |
from tensorflow.python.framework import dtypes | |
from tensorflow.python.framework import tensor_shape | |
from tensorflow.python.keras import backend as K | |
from tensorflow.python.keras import layers | |
from tensorflow.python.keras import initializers | |
from tensorflow.python.ops import array_ops | |
from tensorflow.python.ops import math_ops | |
class SpectralNormalization(layers.Wrapper): |
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
#!/usr/bin/env python | |
import ephem | |
import math | |
''' | |
Takes two PyEphem objects, one for the sun and one for the satellite, and the | |
satellite's standard magnitude value (-1.3 for the International Space Station), | |
and calculates the visual magnitude of the satellite. | |
''' | |
def calculate_visual_magnitude(sun, satellite, standard_magnitude): |
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
import csv | |
import hashlib | |
import re | |
import numpy as np | |
import tensorflow as tf | |
from PIL import Image | |
from tensorflow.python.util import compat | |
class DataHandler: |
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
import tensorflow as tf | |
tf.GraphKeys.USEFUL = 'useful' | |
saver = tf.train.import_meta_graph("./model_ex1.meta") | |
sess = tf.Session() | |
saver.restore(sess, "./model_ex1") | |
var_list = tf.get_collection(tf.GraphKeys.USEFUL) | |
v1 = var_list[0] |
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
import tensorflow as tf | |
tf.GraphKeys.USEFUL = 'useful' | |
v1 = tf.placeholder(tf.float32, name="v1") | |
v2 = tf.placeholder(tf.float32, name="v2") | |
v3 = tf.mul(v1, v2) | |
vx = tf.Variable(10.0, name="vx") | |
v4 = tf.add(v3, vx, name="v4") |
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
#!/usr/bin/env python | |
""" | |
Example of using Keras to implement a 1D convolutional neural network (CNN) for timeseries prediction. | |
""" | |
from __future__ import print_function, division | |
import numpy as np | |
from keras.layers import Convolution1D, Dense, MaxPooling1D, Flatten | |
from keras.models import Sequential |
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
# Working example for my blog post at: | |
# http://danijar.com/variable-sequence-lengths-in-tensorflow/ | |
import functools | |
import sets | |
import tensorflow as tf | |
from tensorflow.models.rnn import rnn_cell | |
from tensorflow.models.rnn import rnn | |
def lazy_property(function): |
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
# Example for my blog post at: | |
# http://danijar.com/introduction-to-recurrent-networks-in-tensorflow/ | |
import functools | |
import sets | |
import tensorflow as tf | |
def lazy_property(function): | |
attribute = '_' + function.__name__ |
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
import tensorflow as tf | |
import numpy as np | |
import os | |
import zconfig | |
import utils | |
class DenoisingAutoencoder(object): | |
""" Implementation of Denoising Autoencoders using TensorFlow. |
NewerOlder