MCPcopy Create free account
hub / github.com/anton-jeran/MESH2IR / MESH_NET

Class MESH_NET

evaluate/model.py:112–163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110 return c_code #, mu, logvar
111
112class MESH_NET(nn.Module):
113 def __init__(self):
114 super(MESH_NET,self).__init__()
115 self.feature_dim = 3
116 self.conv1 = GCNConv(self.feature_dim, 32)
117 self.pool1 = TopKPooling(32, ratio=0.6)
118 self.conv2 = GCNConv(32, 32) #(32, 64)
119 self.pool2 = TopKPooling(32, ratio=0.6) #64, ratio=0.6)
120 self.conv3 = GCNConv(32, 32) #(64, 128)
121 self.pool3 = TopKPooling(32, ratio=0.6) #(128, ratio=0.6)
122 # self.item_embedding = torch.nn.Embedding(num_embeddings=df.item_id.max() +1, embedding_dim=self.feature_dim)
123 self.lin1 = torch.nn.Linear(64, 16) #(256, 128)
124 self.lin2 = torch.nn.Linear(16, 8) #(128, 64)
125 # self.lin3 = torch.nn.Linear(8, 1) #(64, 1)
126 self.bn1 = torch.nn.BatchNorm1d(16) #(128)
127 self.bn2 = torch.nn.BatchNorm1d(8) #(64)
128 self.act1 = torch.nn.ReLU()
129 # self.act2 = torch.nn.ReLU()
130
131 def forward(self, data):
132 x, edge_index, batch = data.pos, data.edge_index, data.batch
133 # x = self.item_embedding(x)
134 # x = x.squeeze(1)
135 # print("batch ",batch)
136 x = F.relu(self.conv1(x, edge_index))
137 x, edge_index, _, batch, _ ,_= self.pool1(x, edge_index, None, batch)
138 x1 = torch.cat([gmp(x, batch), gap(x, batch)], dim=1)
139
140 x = F.relu(self.conv2(x, edge_index))
141
142 x, edge_index, _, batch, _,_ = self.pool2(x, edge_index, None, batch)
143 x2 = torch.cat([gmp(x, batch), gap(x, batch)], dim=1)
144
145 x = F.relu(self.conv3(x, edge_index))
146
147 x, edge_index, _, batch, _,_ = self.pool3(x, edge_index, None, batch)
148 x3 = torch.cat([gmp(x, batch), gap(x, batch)], dim=1)
149 # print("x1 shape ", x1.shape)
150 # print("x2 shape ", x2.shape)
151 # print("x3 shape ", x3.shape)
152 x = x1 + x2 + x3
153
154 x = self.lin1(x)
155 x = self.act1(x)
156 # print("x shape1 ", x.shape)
157 # x = self.lin2(x)
158 # x = self.act2(x)
159 x = F.dropout(x, p=0.5, training=self.training)
160 # print("x shape2 ", x.shape)
161 x = torch.sigmoid(self.lin2(x)).squeeze(1)
162 # print("x shape3 ", x.shape)
163 return x
164
165
166

Callers 2

load_network_stageIFunction · 0.90
load_network_stageIFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected