Advertisement

TensorFlow进行Profile实战

阅读量:

引入所需的相关模块

复制代码
    import os
    import tempfile
    
    import tensorflow as tf
    from tensorflow.examples.tutorials.mnist import input_data
    
    
      
      
      
      
      
    
    
    
    AI写代码python
    
    运行

构建模型

复制代码
    batch_size = 100
    
    # placeholder
    inputs = tf.placeholder(tf.float32, [batch_size, 784])
    targets = tf.placeholder(tf.float32, [batch_size, 10])
    
    # model
    fc_1_out = tf.layers.dense(inputs, 500, activation=tf.nn.sigmoid)
    fc_2_out = tf.layers.dense(fc_1_out, 784, activation=tf.nn.sigmoid)
    logits = tf.layers.dense(fc

全部评论 (0)

还没有任何评论哟~