You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def forward(self, x):
x = F.relu(self.conv1(x))
x = F.max_pool2d(x, 2)
x = F.relu(self.conv2(x))
x = F.max_pool2d(x, 2)
x = self.dropout(x)
# x = x.view(-1, 256)
x = torch.flatten(x, start_dim=1)
x = F.relu(self.fc1(x))
x = self.fc2(x)
x = torch.chunk(x, 10, dim=1)
# x = self.hybrid(x)
x = tuple([hy(x_) for hy, x_ in zip(self.hybrid, x)])
return torch.cat(x, -1)
`
I tried to run this code with batch (32, 1, 28, 28) and obtained output shape was (1, 10), not (32, 10). It wasn't correct. I guess that self.hybrid always ouput with shape (1, 1) regarless the batch size. I mean that with input (32, 1) through self.hybrid I receive an output with shape (32, 1). Thank you.
The text was updated successfully, but these errors were encountered:
`
class Net(nn.Module):
def init(self):
super(Net, self).init()
self.conv1 = nn.Conv2d(1, 6, kernel_size=5)
self.conv2 = nn.Conv2d(6, 16, kernel_size=5)
self.dropout = nn.Dropout2d()
self.fc1 = nn.Linear(256, 64)
self.fc2 = nn.Linear(64, 10)
# self.hybrid = Hybrid(qiskit.Aer.get_backend('qasm_simulator'), 100, np.pi / 2)
self.hybrid = [Hybrid(qiskit.Aer.get_backend('qasm_simulator'), 100, np.pi / 2) for i in range(10)]
`
I tried to run this code with batch (32, 1, 28, 28) and obtained output shape was (1, 10), not (32, 10). It wasn't correct. I guess that self.hybrid always ouput with shape (1, 1) regarless the batch size. I mean that with input (32, 1) through self.hybrid I receive an output with shape (32, 1). Thank you.
The text was updated successfully, but these errors were encountered: