Belle II Software  release-06-02-00
Layer Class Reference

Public Member Functions

def __init__ (self, name, tf_activation_str, dim_input, dim_output, p_bias, p_w, operation_seed=None)
 
def initialize (self, layer_input)
 

Public Attributes

 name
 layer parameters
 
 tf_activation
 activation function
 
 seed
 random seed
 
 shape
 layer shape
 
 w
 init parameters for uniform distribution
 
 b
 init parameters for bias
 
 input
 input
 
 output
 output
 
 is_initialized
 check if initialized (input and output are connected)
 

Private Member Functions

def _init_bias (self, width, init_val, name=None)
 
def _init_weight (self, shape, stddev, operation_seed, name=None)
 
def _add_var_to_summary (self, var)
 
def _add_all_to_summary (self)
 

Detailed Description

definition of a layer obj

Definition at line 21 of file tensorflow_dnn_model.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  name,
  tf_activation_str,
  dim_input,
  dim_output,
  p_bias,
  p_w,
  operation_seed = None 
)
:param name:
:param tf_activation: string, name of an available tensorflow activations function
:param dim_input:
:param dim_output:
:param p_bias: initial constant
:param p_w: stddev of uniform distribution to initialize
:return:

Definition at line 26 of file tensorflow_dnn_model.py.

27  operation_seed=None):
28  """
29  :param name:
30  :param tf_activation: string, name of an available tensorflow activations function
31  :param dim_input:
32  :param dim_output:
33  :param p_bias: initial constant
34  :param p_w: stddev of uniform distribution to initialize
35  :return:
36  """
37 
38  self.name = name
39 
40  tf_activation_dict = {
41  'tanh': tf.tanh,
42  'sigmoid': tf.sigmoid,
43  'relu': tf.nn.relu,
44  'leaky_relu': tf.nn.leaky_relu,
45  }
46 
47  if tf_activation_str not in tf_activation_dict:
48  raise ValueError
49 
50 
51  self.tf_activation = tf_activation_dict[tf_activation_str]
52 
53 
54  self.seed = None
55 
56 
57  self.shape = [dim_input, dim_output]
58 
59 
60  self.w = self._init_weight(self.shape, p_w, operation_seed)
61 
62 
63  self.b = self._init_bias(self.shape[1], p_bias)
64 
65 
66  self.input = None
67 
68 
69  self.output = None
70 
71 
72  self.is_initialized = False
73 
74 
75  self._add_all_to_summary()
76 

Member Function Documentation

◆ _add_all_to_summary()

def _add_all_to_summary (   self)
private
adds tuneable parameters to summary

Definition at line 130 of file tensorflow_dnn_model.py.

◆ _add_var_to_summary()

def _add_var_to_summary (   self,
  var 
)
private
add variables of this layer to tensorboard
:param var: tensorflow variable
:return:

Definition at line 111 of file tensorflow_dnn_model.py.

◆ _init_bias()

def _init_bias (   self,
  width,
  init_val,
  name = None 
)
private
define bias variables

Definition at line 77 of file tensorflow_dnn_model.py.

◆ _init_weight()

def _init_weight (   self,
  shape,
  stddev,
  operation_seed,
  name = None 
)
private
define weight variables

Definition at line 86 of file tensorflow_dnn_model.py.

◆ initialize()

def initialize (   self,
  layer_input 
)
initialization, requires layer input

Definition at line 95 of file tensorflow_dnn_model.py.


The documentation for this class was generated from the following file: