Skip to content

Commit

Permalink
Use refactored gaussian gate from The Walrus (#646)
Browse files Browse the repository at this point in the history
* refactor [tfbackend/ops] -  gaussian_gate_matrix: use new tw signature

* requirement [thewalrus] - point to built wheel from branch

* requirement [docs] - use dev version of the walrus

* fix [docs/requirements] - use python3.7 for docs

* fix [tfbackend/ops] - single_gaussian_gate_matrix: pass new params to tw function

* update [worflows/docs] - use sphinx-action at xanadu with python 3.8

* requirements [docs] - use python3.8 wheel

Co-authored-by: Theodor <theodor@xanadu.ai>
  • Loading branch information
sduquemesa and thisac committed Nov 18, 2021
1 parent 5820d40 commit d7a4ec4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: josh146/sphinx-action@master
- uses: XanaduAI/sphinx-action@master
with:
docs-folder: "doc/"
repo-token: "${{ secrets.GITHUB_TOKEN }}"
Expand Down
4 changes: 2 additions & 2 deletions doc/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ sphinx-copybutton
sphinx-automodapi
sphinxcontrib-bibtex==0.4.2
tensorflow==2.6.1
thewalrus>=0.16.0
toml
http://xanadu-wheels.s3-website-us-east-1.amazonaws.com/thewalrus-0.17.0.dev0+20211117203611-cp38-cp38-manylinux2014_x86_64.whl#sha256=f8cef1f05a903eec2b563758b7542490681dfc899e57cce1542385546e222306
toml
2 changes: 1 addition & 1 deletion requirements-ci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ tensorboard
networkx
quantum-blackbird
python-dateutil
thewalrus
http://xanadu-wheels.s3-website-us-east-1.amazonaws.com/thewalrus-0.17.0.dev0+20211117203611-cp38-cp38-manylinux2014_x86_64.whl#sha256=f8cef1f05a903eec2b563758b7542490681dfc899e57cce1542385546e222306
toml
appdirs
numba
Expand Down
6 changes: 3 additions & 3 deletions strawberryfields/backends/tfbackend/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@
from thewalrus.fock_gradients import grad_mzgate as grad_mzgate_tw
from thewalrus.fock_gradients import two_mode_squeezing as two_mode_squeezing_tw
from thewalrus.fock_gradients import grad_two_mode_squeezing as grad_two_mode_squeezing_tw
from thewalrus._hermite_multidimensional import hermite_multidimensional_numba as gaussian_gate_tw
from thewalrus._hermite_multidimensional import hermite_multidimensional as gaussian_gate_tw
from thewalrus._hermite_multidimensional import (
grad_hermite_multidimensional_numba as grad_gaussian_gate_tw,
grad_hermite_multidimensional as grad_gaussian_gate_tw,
)
from thewalrus.symplectic import is_symplectic, sympmat

Expand Down Expand Up @@ -525,7 +525,7 @@ def choi_trick(S, d, dtype=tf.complex128):
@tf.custom_gradient
def single_gaussian_gate_matrix(R, y, C, cutoff, dtype=tf.complex128):
"""creates a N-mode gaussian gate matrix"""
gate = tf.numpy_function(gaussian_gate_tw, [R, cutoff, y, C], tf.complex128)
gate = tf.numpy_function(gaussian_gate_tw, [R, cutoff, y, C, True, True, True], tf.complex128)
N = y.shape[-1] // 2
transpose_list = [x for pair in zip(range(N), range(N, 2 * N)) for x in pair]

Expand Down

0 comments on commit d7a4ec4

Please sign in to comment.