Belle II Software  release-08-01-10
Layer Class Reference
Inheritance diagram for Layer:
Collaboration diagram for Layer:

Public Member Functions

def __init__ (self, name, tf_activation_str, dim_input, dim_output, p_bias, p_w, random_seed=None)
 
def __call__ (self, x)
 
def variable_to_summary (self, var, step, writer)
 
def all_to_summary (self, step, writer)
 

Public Attributes

 tf_activation
 layer parameters More...
 
 shape
 layer shape
 
 w
 init parameters for uniform distribution
 
 b
 init parameters for bias
 
 input
 input
 
 output
 output
 

Private Member Functions

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

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,
  random_seed = None 
)
:param name: name of the layer.
:param tf_activation: string, name of an available tensorflow activations function
:param dim_input: dimension of the input
:param dim_output: dimension of the output
:param p_bias: initial bias
:param p_w: stddev of uniform distribution to initialize
:param random_seed: random seed used in initialising the weights
:return: None

Definition at line 26 of file tensorflow_dnn_model.py.

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

Member Function Documentation

◆ __call__()

def __call__ (   self,
  x 
)
evaluate the layer

Definition at line 88 of file tensorflow_dnn_model.py.

◆ _init_bias()

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

Definition at line 69 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 78 of file tensorflow_dnn_model.py.

◆ all_to_summary()

def all_to_summary (   self,
  step,
  writer 
)
Passes all layer variables to the tf.summary writer.

Definition at line 109 of file tensorflow_dnn_model.py.

◆ variable_to_summary()

def variable_to_summary (   self,
  var,
  step,
  writer 
)
Passes information about each variable to the summary writer.

Definition at line 94 of file tensorflow_dnn_model.py.

Member Data Documentation

◆ tf_activation

tf_activation

layer parameters

activation function

Definition at line 52 of file tensorflow_dnn_model.py.


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