Giter VIP home page Giter VIP logo

quantum-neural-network's Introduction

quantum-neural-network

Exploring Hybrid quantum-classical Neural Networks with PyTorch and Qiskit

๐ŸŽ‰Qiskit Hackathon Korea 2021 : Community Choice Award Winner๐ŸŽ‰

name github role
Kifumi Numata @kifumi Coach, Qiskit Advocate
Anna Phan @attp Coach, Qiskit Advocate
Dohun Kim @yh08037 Code development - model1/model2
Yunseo Kim @Yunseo47 Code development - model2, Presentation
Jaehoon Hahm @Jaehoon-zx Create presentation slides, Presentation
DaeHeon Yoon @Greathoney Code development - model1, Create presentation slides
Yoon Kwon @vhapfks Create presentation slides
Eunchan Lee @purang2 Code development - model1

Build MNIST multi-label classifiers using classical convolution layers and quantum fully-connected layers.

Build MNIST multi-label classifiers using quantum convolution layers and classical fully-connected layers.

References

quantum-neural-network's People

Contributors

greathoney avatar purang2 avatar yh08037 avatar yunseo-kim avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

quantum-neural-network's Issues

Shape of output through self.hybrid is not correct?

`
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)]

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.

self: qiskit_aer.backends.controller_wrappers.AerConfig, arg0: List[List[Tuple[Tuple[int, int], List[float]]]]) -> None

Dear author,

I am runing your code. But it appears ane error. I don't know how to fix it, althrough I reinstalled environment as you said but It is not workiing. It seems can not run circuit data, right?
The errors is:
`TypeError: (): incompatible function arguments. The following argument types are supported:
1. (self: qiskit_aer.backends.controller_wrappers.AerConfig, arg0: List[List[Tuple[Tuple[int, int], List[float]]]]) -> None

Invoked with: <qiskit_aer.backends.controller_wrappers.AerConfig object at 0x0000025F3E64C0B0>, [[[(0, 0), 0], [(1, 0), 0], [(2, 0), 0], [(3, 0), 0], [(4, 0), 0], [(5, 0), 0], [(6, 0), 0], [(7, 0), 0], [(8, 0), 0], [(9, 0), 0], [(10, 0), 0], [(11, 0), 0], [(12, 0), 0], [(13, 0), 0], [(14, 0), 0], [(15, 0), 0], [(16, 0), 0], [(17, 0), 0], [(18, 0), 0], [(19, 0), 0], [(20, 0), 0], [(21, 0), 0], [(22, 0), 0], [(23, 0), 0], [(24, 0), 0]]] `

TypeError: unsupported operand type(s) for +: 'QuantumCircuit' and 'QuantumCircuit'

Hello. Thank you for the interesting project.

In classQuanvCircuit, '+=' in the init function definition was replaced with two lines because QuantumCircuit said it could not be used. Does this mean the same thing? I also wonder if there is a better solution.

# self._circuit += random_circuit(self.n_qubits, 2) self._circuit = random_circuit(self.n_qubits, 1) #replaced self._circuit = random_circuit(self.n_qubits, 1) #replaced

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.