zoukankan      html  css  js  c++  java
  • A TensorFLow CheatSheet

    Commonly used functions

    • tf.saved_model.loader.load(sess, tags, export_dir)
    • tf.get_default_graph() # Return the default Graph being used in the current thread.
    • graph.get_tensor_by_name(tensor_name)
    • tf.reshape(

      tensor, shape, name=None

      )

    Define Layers

    • tf.layers.conv2d(
          inputs,
          filters,
          kernel_size,
          strides=(1, 1),
          padding='valid',
          data_format='channels_last',
          dilation_rate=(1, 1),
          activation=None,
          use_bias=True,
          kernel_initializer=None,
          bias_initializer=tf.zeros_initializer(),
          kernel_regularizer=None,
          bias_regularizer=None,
          activity_regularizer=None,
          kernel_constraint=None,
          bias_constraint=None,
          trainable=True,
          name=None,
          reuse=None
      ) # convolution
    • tf.layers.conv2d_transpose(
          inputs,
          filters,
          kernel_size,
          strides=(1, 1),
          padding='valid',
          data_format='channels_last',
          activation=None,
          use_bias=True,
          kernel_initializer=None,
          bias_initializer=tf.zeros_initializer(),
          kernel_regularizer=None,
          bias_regularizer=None,
          activity_regularizer=None,
          kernel_constraint=None,
          bias_constraint=None,
          trainable=True,
          name=None,
          reuse=None
      ) # upsample or deconvolution
    • tf.add(x, y, name=None) # skip connection (element-wise addition)

    Opimizers

    • tf.train.AdamOptimizer(
          learning_rate=0.001,
          beta1=0.9,
          beta2=0.999,
          epsilon=1e-08,
          use_locking=False,
          name='Adam'
      )

    Loss Function

    • tf.nn.softmax_cross_entropy_with_logits(
          _sentinel=None,
          labels=None,
          logits=None,
          dim=-1,
          name=None
      )

    Regularizer

    • tf.contrib.layers.l2_regularizer(

          scale,
          scope=None

      )

    Initializer 

    • tf.random_normal_initializer(
          mean=0.0,
          stddev=1.0,
          seed=None,
          dtype=tf.float32
      )
  • 相关阅读:
    关于android中两种service的编写简单总结
    To learn list
    android中如何在系统启动的时候启动自己的service
    service的生命周期以及两种service的差异
    Intent的简单概述
    关于startactivity初始化activity的过程以及activity和window以及view的关系
    android activity生命周期的一张经典图片
    关于Android进程的启动和消亡
    Java基础学习总结(73)——Java最新面试题汇总
    Beetl学习总结(4)——Web集成
  • 原文地址:https://www.cnblogs.com/casperwin/p/8294637.html
Copyright © 2011-2022 走看看