def __init__(self, device, decimator_dimension, prediction_dimension, edge_dimension, meta_data_dimension, mem_hidden_dimension, agg_hidden_dimension, mem_agg_hidden_dimension, variable_classifier=None, function_classifier=None): super(NeuralPredictor, self).__init__() self._device = device self._module_list = nn.ModuleList() self._variable_classifier = variable_classifier self._function_classifier = function_classifier self._hidden_dimension = decimator_dimension if variable_classifier is not None: self._variable_aggregator = util.MessageAggregator(device, decimator_dimension + edge_dimension + meta_data_dimension, decimator_dimension, mem_hidden_dimension, mem_agg_hidden_dimension, agg_hidden_dimension, 0, include_self_message=True) self._module_list.append(self._variable_aggregator) self._module_list.append(self._variable_classifier) if function_classifier is not None: self._function_aggregator = util.MessageAggregator(device, decimator_dimension + edge_dimension + meta_data_dimension, decimator_dimension, mem_hidden_dimension, mem_agg_hidden_dimension, agg_hidden_dimension, 0, include_self_message=True) self._module_list.append(self._function_aggregator) self._module_list.append(self._function_classifier)
def __init__(self, device, edge_dimension, decimator_dimension, meta_data_dimension, hidden_dimension, mem_hidden_dimension, mem_agg_hidden_dimension, agg_hidden_dimension, dropout): super(NeuralMessagePasser, self).__init__() self._device = device self._module_list = nn.ModuleList() self._drop_out = dropout self._variable_aggregator = util.MessageAggregator( device, decimator_dimension + edge_dimension + meta_data_dimension, hidden_dimension, mem_hidden_dimension, mem_agg_hidden_dimension, agg_hidden_dimension, edge_dimension, include_self_message=False) self._function_aggregator = util.MessageAggregator( device, decimator_dimension + edge_dimension + meta_data_dimension, hidden_dimension, mem_hidden_dimension, mem_agg_hidden_dimension, agg_hidden_dimension, edge_dimension, include_self_message=False) self._module_list.append(self._variable_aggregator) self._module_list.append(self._function_aggregator) self._hidden_dimension = hidden_dimension self._mem_hidden_dimension = mem_hidden_dimension self._agg_hidden_dimension = agg_hidden_dimension self._mem_agg_hidden_dimension = mem_agg_hidden_dimension
def __init__(self, device, edge_dimension, decimator_dimension, meta_data_dimension, hidden_dimension, mem_hidden_dimension, mem_agg_hidden_dimension, agg_hidden_dimension, dropout): super(NeuralMessagePasser, self).__init__() self._device = device self._module_list = nn.ModuleList() self._drop_out = dropout self._variable_aggregator = util.MessageAggregator( device, decimator_dimension + edge_dimension + meta_data_dimension, hidden_dimension, mem_hidden_dimension, mem_agg_hidden_dimension, agg_hidden_dimension, edge_dimension, include_self_message=False) self._function_aggregator = util.MessageAggregator( device, decimator_dimension + edge_dimension + meta_data_dimension, hidden_dimension, mem_hidden_dimension, mem_agg_hidden_dimension, agg_hidden_dimension, edge_dimension, include_self_message=False) self._module_list.append(self._variable_aggregator) self._module_list.append(self._function_aggregator) self._hidden_dimension = hidden_dimension self._mem_hidden_dimension = mem_hidden_dimension self._agg_hidden_dimension = agg_hidden_dimension self._mem_agg_hidden_dimension = mem_agg_hidden_dimension self._flag = False self._n_head = 8 self._n_layers = 4 self._d_k = self._hidden_dimension / self._n_head self.pre_embedding = np.load('datasets/arr_0.npy')