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 python3 | |
# coding=utf-8 | |
import collections | |
import sys | |
import itertools | |
import matplotlib.pyplot as plt | |
import matplotlib as mpl | |
import time | |
import datetime |
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.platform import gfile | |
import tensorflow as tf | |
from tensorflow.contrib import tensorrt as trt | |
graph_filename ='resnetV150_frozen.pb' | |
f = gfile.FastGFile(graph_filename, 'rb') | |
# define graph def object | |
frozen_graph_def = tf.GraphDef() |
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 | |
def int_shape(x): | |
list = x.get_shape().as_list() | |
return list | |
def _activation_summary(x): |
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
class Landmark { | |
public: | |
Landmark(float x, float y, SDL_Color id); | |
~Landmark(); | |
Position pos; | |
SDL_Color id; | |
void render(SDL_Renderer * ren); | |
}; |
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
class Robot { | |
public: | |
Robot(int x_start, int y_start, float orientation, int radius, SDL_Color col); | |
~Robot(); | |
void render(SDL_Renderer * ren); | |
void move(const Uint8 * , Eigen::VectorXf & control); | |
void moveForward(Eigen::VectorXf & control); | |
void moveBackward(Eigen::VectorXf & control); | |
void rotateLeft(Eigen::VectorXf & control); |
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
class KalmanFilter { | |
public: | |
/** | |
* Create a Kalman filter with the specified matrices. | |
* A - System dynamics matrix | |
* C - Output matrix | |
* Q - Process noise covariance | |
* R - Measurement noise covariance |
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 numpy as np | |
import matplotlib.pyplot as plt | |
import time | |
L = 1.0 # length of 1-D heat-conducting object | |
Nx = 100 # number of spatial grid points | |
T = 10.0 # maximum time | |
Nt = 1000 # number of time steps | |
a = 0.005 # material proberty alpha |
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
def resnet_layer(inputs, | |
num_filters=16, | |
kernel_size=3, | |
strides=1, | |
activation='relu', | |
batch_normalization=True, | |
conv_first=True): | |
"""2D Convolution-Batch Normalization-Activation stack builder | |
# Arguments | |
inputs (tensor): input tensor from input image or previous layer |
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 os | |
import pprint | |
import tensorflow as tf | |
if 'COLAB_TPU_ADDR' not in os.environ: | |
print('ERROR: Not connected to a TPU runtime; please see the first cell in this notebook for instructions!') | |
else: | |
tpu_address = 'grpc://' + os.environ['COLAB_TPU_ADDR'] | |
print ('TPU address is', tpu_address) |
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
# This address identifies the TPU we'll use when configuring TensorFlow. | |
TPU_WORKER = 'grpc://' + os.environ['COLAB_TPU_ADDR'] | |
tf.logging.set_verbosity(tf.logging.INFO) | |
resnet_model = tf.contrib.tpu.keras_to_tpu_model( | |
resnet_model, | |
strategy=tf.contrib.tpu.TPUDistributionStrategy( | |
tf.contrib.cluster_resolver.TPUClusterResolver(TPU_WORKER))) |
OlderNewer