Beispiel #1
0
 def _get_weights(self, var_name, shape, init=tl.initializers.random_normal()):
     """ Get trainable variables. """
     weight = get_variable_with_initializer(scope_name=self.name, var_name=var_name, shape=shape, init=init)
     if self._weights is None:
         self._weights = list()
     self._weights.append(weight)  # Add into the weight collection
     return weight
Beispiel #2
0
 def _get_weights(self, var_name, shape, init=tl.initializers.random_normal(), trainable=True):
     """ Get trainable variables. """
     weight = get_variable_with_initializer(scope_name=self.name, var_name=var_name, shape=shape, init=init)
     if trainable is True:
         if self._trainable_weights is None:
             self._trainable_weights = list()
         self._trainable_weights.append(weight)
     else:
         if self._nontrainable_weights is None:
             self._nontrainable_weights = list()
         self._nontrainable_weights.append(weight)
     return weight
Beispiel #3
0
 def _get_weights(self,
                  var_name,
                  shape,
                  init=tl.initializers.random_normal()):
     """ Get trainable variables. """
     weight = get_variable_with_initializer(scope_name=self.name,
                                            var_name=var_name,
                                            shape=shape,
                                            init=init)
     if self._weights is None:
         self._weights = list()
     self._weights.append(weight)  # Add into the weight collection
     return weight
Beispiel #4
0
 def _get_weights(self,
                  var_name,
                  shape,
                  init=tl.initializers.random_normal()):
     weight = get_variable_with_initializer(scope_name=self.name,
                                            var_name=var_name,
                                            shape=shape,
                                            init=init)
     if self._weights is None:
         self._weights = list()
     self._weights.append(weight)  # Add into the weight collection
     # self.__setattr__(var_name, weight) # FIXME: prefer to remove this line, the weights should be manually defined as members of the Layer
     return weight