This file contains hidden or 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 unittest | |
import tensorflow as tf | |
import sys | |
import os | |
class TestGPU(unittest.TestCase): | |
def setUp(self): | |
os.environ["CUDA_VISIBLE_DEVICES"]='0' | |
def test_gpu(self): |
This file contains hidden or 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 functools | |
def singleton(cls, *args, **kw): | |
instances = dict() | |
@functools.wraps(cls) | |
def _fun(): | |
if cls not in instances: | |
instances[cls] = cls(*args, **kw) | |
return instances[cls] | |
return _fun |
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 hidden or 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
# ------------ | |
# https://classroom.udacity.com/courses/cs373/lessons/48736210/concepts/486838410923 | |
# ------------ | |
# User Instructions | |
# | |
# In this problem you will implement a more manageable | |
# version of graph SLAM in 2 dimensions. | |
# | |
# Define a function, online_slam, that takes 5 inputs: | |
# data, N, num_landmarks, motion_noise, and |
This file contains hidden or 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
# ------------ | |
# User Instructions | |
# | |
# In this problem you will implement SLAM in a 2 dimensional | |
# world. Please define a function, slam, which takes five | |
# parameters as input and returns the vector mu. This vector | |
# should have x, y coordinates interlaced, so for example, | |
# if there were 2 poses and 2 landmarks, mu would look like: | |
# | |
# mu = matrix([[Px0], |
This file contains hidden or 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
# Landmark constraints are set in the same way as the robot positions. | |
# i.e., | |
# x0 - l0 = -z0 | |
# -x0 + l0 = z0 | |
# https://classroom.udacity.com/courses/cs373/lessons/48696626/concepts/486966250923 | |
# ----------- | |
# User Instructions | |
# | |
# Modify your doit function to incorporate 3 | |
# distance measurements to a landmark(Z0, Z1, Z2). |
This file contains hidden or 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
# The program incrementally apply constraints into matrix omega and vector xi. | |
# The final estimation of robot position is thus given by | |
# mu = omega.inverse() * xi | |
# notice the steps | |
# | |
# [1, 0, 0] -> [init] | |
# | |
# [1, -1, 0] -> [-move1] | |
# [-1, 1, 0] -> [move1] | |
# so on and so forth. |
This file contains hidden or 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
# In this example, localization (particle filter), planning (A*, smooth), control (PID) | |
# are put all altogether to make a real robot run from init to goal. | |
# | |
# https://classroom.udacity.com/courses/cs373/lessons/48696626/concepts/484039410923 | |
# ----------- | |
# User Instructions | |
# | |
# Familiarize yourself with the code below. Most of it | |
# reproduces results that you have obtained at some | |
# point in this class. Once you understand the code, |
This file contains hidden or 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
# ------------- | |
# User Instructions | |
# | |
# Now you will be incorporating fixed points into | |
# your smoother. | |
# | |
# You will need to use the equations from gradient | |
# descent AND the new equations presented in the | |
# previous lecture to implement smoothing with | |
# fixed points. |
This file contains hidden or 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
# https://classroom.udacity.com/courses/cs373/lessons/48721468/concepts/487421890923 | |
# ------------- | |
# User Instructions | |
# | |
# Here you will be implementing a cyclic smoothing | |
# algorithm. This algorithm should not fix the end | |
# points (as you did in the unit quizzes). You | |
# should use the gradient descent equations that | |
# you used previously. | |
# |
NewerOlder