91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

生成式對抗網絡(GAN, Generative Adversarial Networks )是一種深度學習模型,是近年來復雜分布上無監督學習最具前景的方法之一。

資源截圖

代碼片段和文件信息

“““
Know?more?visit?my?Python?tutorial?page:?https://morvanzhou.github.io/tutorials/
My?Youtube?Channel:?https://www.youtube.com/user/MorvanZhou

Dependencies:
tensorflow:?1.1.0
matplotlib
numpy
“““
import?tensorflow?as?tf
import?numpy?as?np
import?matplotlib.pyplot?as?plt

tf.set_random_seed(1)
np.random.seed(1)

#?Hyper?Parameters
BATCH_SIZE?=?64
LR_G?=?0.0001???????????#?learning?rate?for?generator
LR_D?=?0.0001???????????#?learning?rate?for?discriminator
N_IDEAS?=?5?????????????#?think?of?this?as?number?of?ideas?for?generating?an?art?work?(Generator)
ART_COMPONENTS?=?15?????#?it?could?be?total?point?G?can?draw?in?the?canvas
PAINT_POINTS?=?np.vstack([np.linspace(-1?1?ART_COMPONENTS)?for?_?in?range(BATCH_SIZE)])

#?show?our?beautiful?painting?range
plt.plot(PAINT_POINTS[0]?2?*?np.power(PAINT_POINTS[0]?2)?+?1?c=‘#74BCFF‘?lw=3?label=‘upper?bound‘)
plt.plot(PAINT_POINTS[0]?1?*?np.power(PAINT_POINTS[0]?2)?+?0?c=‘#FF9359‘?lw=3?label=‘lower?bound‘)
plt.legend(loc=‘upper?right‘)
plt.show()


def?artist_works():?????#?painting?from?the?famous?artist?(real?target)
????a?=?np.random.uniform(1?2?size=BATCH_SIZE)[:?np.newaxis]
????paintings?=?a?*?np.power(PAINT_POINTS?2)?+?(a-1)
????return?paintings


with?tf.variable_scope(‘Generator‘):
????G_in?=?tf.placeholder(tf.float32?[None?N_IDEAS])??????????#?random?ideas?(could?from?normal?distribution)
????G_l1?=?tf.layers.dense(G_in?128?tf.nn.relu)
????G_out?=?tf.layers.dense(G_l1?ART_COMPONENTS)???????????????#?making?a?painting?from?these?random?ideas

with?tf.variable_scope(‘Discriminator‘):
????real_art?=?tf.placeholder(tf.float32?[None?ART_COMPONENTS]?name=‘real_in‘)???#?receive?art?work?from?the?famous?artist
????D_l0?=?tf.layers.dense(real_art?128?tf.nn.relu?name=‘l‘)
????prob_artist0?=?tf.layers.dense(D_l0?1?tf.nn.sigmoid?name=‘out‘)??????????????#?probability?that?the?art?work?

評論

共有 條評論