Skip to content

Instantly share code, notes, and snippets.

# -*- coding: utf-8 -*-
# tf.train.Coordinator 예제
# original source:
# https://github.com/Hezi-Resheff/Oreilly-Learning-TensorFlow/blob/master/08__queues_threads/queue_basic.py
from __future__ import print_function
import tensorflow as tf
# -*- coding: utf-8 -*-
# original source:
# https://github.com/Hezi-Resheff/Oreilly-Learning-TensorFlow/blob/master/08__queues_threads/queue_basic.py
from __future__ import print_function
import tensorflow as tf
import threading
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# -*- coding: utf-8 -*-
# tf.get_variable & tf.variable_scope 예제 (변수가 공유된다.)
# MNIST 데이터를 다운로드 한다.
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
import tensorflow as tf
# -*- coding: utf-8 -*-
#tf.Variable 예제 (변수 공유 안됨)
# MNIST 데이터를 다운로드 한다.
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
import tensorflow as tf
# -*- coding: utf-8 -*-
"""
CIFAR-10 Convolutional Neural Networks(CNN) Example
next_batch function is copied from edo's answer
https://stackoverflow.com/questions/40994583/how-to-implement-tensorflows-next-batch-for-own-data
Author : solaris33
import numpy as np
import matplotlib.pyplot as plt
mu, sigma = 0, 0.1 # mean and standard deviation
# np.random.nomral 함수를 이용해서 평균 0, 표준편차 0.1인 sample들을 1000개 추출한다.
s = np.random.normal(mu, sigma, 1000)
# sample들의 historgram을 출력한다.
count, bins, ignored = plt.hist(s, 30, normed=True)
# sample들을 이용해서 Gaussian Distribution의 shape을 재구축해서 line으로 그린다.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# -*- coding: utf-8 -*-
import gym
import numpy as np
import random
import math
from time import sleep
## Initialize the "Cart-Pole" environment
# -*- coding: utf-8 -*-
import gym
env = gym.make('CartPole-v0')
for i_episode in range(20):
# 새로운 에피소드(initial environment)를 불러온다(reset)
observation = env.reset()
for t in range(100):
env.render()