コード例 #1
0
ファイル: pooling.py プロジェクト: Szonek/EnvNet
 def __init__(self, id, input, pooling_shape, pooling_type, stride=None):
     ErrorHandler.is_type_generic(pooling_shape, tuple)
     ErrorHandler.is_type_generic(pooling_type, PoolingType)
     super().__init__(id, [input])
     self.pooling_shape = pooling_shape
     self.pooling_type = pooling_type
     self.stride = stride
コード例 #2
0
ファイル: memory_impl.py プロジェクト: Szonek/EnvNet
 def fill_data(self, new_data):
     copied_data = new_data
     if isinstance(copied_data, list):
         copied_data = np.asarray(new_data, dtype=float)
     else:
         ErrorHandler.is_type_generic(copied_data, np.ndarray)
         ErrorHandler.is_equal(self.shape, copied_data.shape)
     self.__data = copied_data
コード例 #3
0
ファイル: pooling_node.py プロジェクト: Szonek/EnvNet
 def calc_output_shape(self, input_shape):
     ErrorHandler.is_type_generic(input_shape, tuple)
     nout = input_shape[0]
     cout = input_shape[1]
     hout = int((input_shape[2] -
                 (self.pooling_shape[0] - 1) - 1) / self.stride[0] + 1)
     wout = int((input_shape[3] -
                 (self.pooling_shape[1] - 1) - 1) / self.stride[1] + 1)
     return (nout, cout, hout, wout)
コード例 #4
0
ファイル: concatenation.py プロジェクト: Szonek/EnvNet
 def __init__(self, id, inputs, axis=0):
     ErrorHandler.is_list(inputs)
     ErrorHandler.is_type_generic(axis, int)
     super().__init__(id, inputs)
     self.axis = axis
コード例 #5
0
 def __init__(self, id, input, new_shape):
     ErrorHandler.is_type_generic(new_shape, tuple)
     super().__init__(id, [input])
     self.new_shape = new_shape
コード例 #6
0
ファイル: container.py プロジェクト: Szonek/EnvNet
 def __init__(self, id, memory):
     ErrorHandler.is_type_generic(memory, Memory)
     super().__init__(id, [])
     self.memory = memory
コード例 #7
0
 def add_node(self, node):
     ErrorHandler.is_type_generic(node, Node)
     if node.id in self.nodes_map:
         ErrorHandler.raise_error(node.id + "is already in nodes_map!!!")
     self.nodes_map[node.id] = node
コード例 #8
0
 def __init__(self, id, input, activation_function):
     ErrorHandler.is_type_generic(activation_function, ActivationFunctions)
     super().__init__(id, [input])
     self.activation = activation_function
コード例 #9
0
ファイル: memory_impl.py プロジェクト: Szonek/EnvNet
 def __init__(self, shape):
     ErrorHandler.is_type_generic(shape, tuple)
     self.shape = shape
     self.__data = np.empty(shape)