Skip to content

Commit

Permalink
Release/0.1.0 (#68)
Browse files Browse the repository at this point in the history
* prepare 0.1.0 release
  • Loading branch information
eileen-kuehn authored May 13, 2022
1 parent 074a4a0 commit 6c83b0a
Show file tree
Hide file tree
Showing 17 changed files with 207 additions and 8 deletions.
1 change: 1 addition & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ python:
path: .
extra_requirements:
- doc
- datasets

sphinx:
builder: html
Expand Down
2 changes: 2 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ Ensemble-based gate dropouts for quantum circuits
source/masks
source/ensembles
source/glossary
Module Index <source/api/modules>

.. toctree::
:maxdepth: 1
:caption: Development
:hidden:

source/changelog
CONTRIBUTING.md
source/publishing

Expand Down
45 changes: 45 additions & 0 deletions docs/source/api/maskit.datasets.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
maskit.datasets package
=======================

Submodules
----------

maskit.datasets.circles module
------------------------------

.. automodule:: maskit.datasets.circles
:members:
:undoc-members:
:show-inheritance:

maskit.datasets.iris module
---------------------------

.. automodule:: maskit.datasets.iris
:members:
:undoc-members:
:show-inheritance:

maskit.datasets.mnist module
----------------------------

.. automodule:: maskit.datasets.mnist
:members:
:undoc-members:
:show-inheritance:

maskit.datasets.utils module
----------------------------

.. automodule:: maskit.datasets.utils
:members:
:undoc-members:
:show-inheritance:

Module contents
---------------

.. automodule:: maskit.datasets
:members:
:undoc-members:
:show-inheritance:
77 changes: 77 additions & 0 deletions docs/source/api/maskit.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
maskit package
==============

Subpackages
-----------

.. toctree::
:maxdepth: 4

maskit.datasets

Submodules
----------

maskit.circuits module
----------------------

.. automodule:: maskit.circuits
:members:
:undoc-members:
:show-inheritance:

maskit.ensembles module
-----------------------

.. automodule:: maskit.ensembles
:members:
:undoc-members:
:show-inheritance:

maskit.log\_results module
--------------------------

.. automodule:: maskit.log_results
:members:
:undoc-members:
:show-inheritance:

maskit.masks module
-------------------

.. automodule:: maskit.masks
:members:
:undoc-members:
:show-inheritance:

maskit.optimizers module
------------------------

.. automodule:: maskit.optimizers
:members:
:undoc-members:
:show-inheritance:

maskit.plotting module
----------------------

.. automodule:: maskit.plotting
:members:
:undoc-members:
:show-inheritance:

maskit.utils module
-------------------

.. automodule:: maskit.utils
:members:
:undoc-members:
:show-inheritance:

Module contents
---------------

.. automodule:: maskit
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/api/modules.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
maskit
======

.. toctree::
:maxdepth: 4

maskit
17 changes: 17 additions & 0 deletions docs/source/changelog.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.. Created by log.py at 2022-05-13, command
'/Users/eileenwork/development/tmp/google_paper/venv/lib/python3.8/site-packages/change/__main__.py log docs/source/changes compile --output docs/source/changelog.rst'
based on the format of 'https://keepachangelog.com/'
#########
ChangeLog
#########

0.1 Series
==========

Version [0.1.0] - 2022-05-13
++++++++++++++++++++++++++++

* **[Added]** Add mask for wires, layers, and parameters
* **[Added]** Add mask to change values by an offset
* **[Added]** Add mask for freezing
* **[Added]** Add mask for entangling gates
9 changes: 9 additions & 0 deletions docs/source/changes/17.freeze_mask.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
category: added
summary: "Add mask for freezing"
description: |
A mask for freezing parts of a circuit was added. The different dimensions including
wires, layers, and single parameters can be frozen. Frozen parts of a circuit cannot
be changed anymore during training.
pull requests:
- 17
version: 0.1.0
8 changes: 8 additions & 0 deletions docs/source/changes/32.entangling_mask.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
category: added
summary: "Add mask for entangling gates"
description: |
So far only masking of gates defined via parameters was supported. This change
introduces the functionality to also mask entangling gates.
pull requests:
- 32
version: 0.1.0
10 changes: 10 additions & 0 deletions docs/source/changes/54.value_mask.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
category: added
summary: "Add mask to change values by an offset"
description: |
With this change it is supported to apply a mask to parameter values. With this, it
becomes possible to add or reduce parameters by a specific offset given the various
axes, i.e. wires, layers, or parameters.
pull requests:
- 54
- 50
version: 0.1.0
7 changes: 7 additions & 0 deletions docs/source/changes/9.basic_masks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
category: added
summary: "Add mask for wires, layers, and parameters"
description: "This change adds basic functionality to mask the dimensions of wires,\
\ layers, and \nsingle parameters.\n"
pull requests:
- 9
version: 0.1.0
2 changes: 2 additions & 0 deletions docs/source/changes/versions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- semver: 0.1.0
date: '2022-05-13'
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ def test(
"layers": 5,
# "starting_layers": 10, # only relevant if "dropout" == "growing"
"steps": 1000,
"dataset": "simple",
"dataset": "iris",
"testing": True,
"ensemble_type": AdaptiveEnsemble,
"ensemble_kwargs": {
Expand Down
2 changes: 1 addition & 1 deletion maskit/_masked_circuits.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ def full_circuit(


if __name__ == "__main__":
parameter = MaskedCircuit(
parameter = MaskedCircuit.full_circuit(
np.array(([21, 22, 23], [11, 22, 33], [43, 77, 89])), 3, 3
)
parameter.mask(Axis.WIRES)[1] = True
Expand Down
5 changes: 4 additions & 1 deletion maskit/circuits.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ def basic_variational_circuit(params, rotations, masked_circuit: MaskedCircuit):


def variational_circuit(params, rotations, masked_circuit):
masked_circuit = masked_circuit.unwrap()
try: # versions prior to PennyLane 0.23 required unwrapping the object
masked_circuit = masked_circuit.unwrap()
except AttributeError:
pass
basic_variational_circuit(
params=params,
rotations=rotations,
Expand Down
2 changes: 1 addition & 1 deletion maskit/optimizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class L_BFGS_B:
in scipy. Please see the :py:func:`~sciopt.fmin_l_bfgs_b` documentation for
further details.
In case the method :py:method:`~.step` is used, the value of parameter `maxiter`
In case the method :py:meth:`~.step` is used, the value of parameter `maxiter`
is ignored and interpreted as `1` instead.
:param bounds: tuple of `min` and `max` for each value of provided parameters
Expand Down
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dynamic = ["version", "description"]
license = {file = "LICENSE"}
keywords = ["quantum computing",]
dependencies = [
"pennylane ~= 0.18.0",
"pennylane ~= 0.23",
"typing_extensions",
]

Expand All @@ -32,8 +32,9 @@ test = [
]
datasets = [
"tensorflow >=2.0.0",
"scikit-learn",
]
dev = ["pre-commit"]
dev = ["pre-commit", "change-log"]
doc = [
"sphinx",
"myst-parser",
Expand Down
14 changes: 12 additions & 2 deletions tests/test_masked_circuits.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,11 +372,21 @@ def test_entangling_mask_application(self):
)

circuit(mp.differentiable_parameters, rotations, mp)
assert circuit.specs["gate_types"]["CZ"] == 12
assert (
qml.specs(circuit)(mp.differentiable_parameters, rotations, mp)[
"gate_types"
]["CZ"]
== 12
)

mp.perturb(axis=Axis.ENTANGLING, mode=Mode.SET, amount=6)
circuit(mp.differentiable_parameters, rotations, mp)
assert circuit.specs["gate_types"]["CZ"] == 6
assert (
qml.specs(circuit)(mp.differentiable_parameters, rotations, mp)[
"gate_types"
]["CZ"]
== 6
)

def _create_circuit(self, size):
parameters = pnp.random.uniform(low=-pnp.pi, high=pnp.pi, size=(size, size))
Expand Down

0 comments on commit 6c83b0a

Please sign in to comment.