tencent-quantum-lab / tensorcircuit

Tensor network based quantum software framework for the NISQ era
https://tensorcircuit.readthedocs.io
Apache License 2.0
252 stars 75 forks source link

fix(qir2cirq): add a parameter 'args' for '_circuit_diagram_info_' #188

Closed ztzhu1 closed 8 months ago

ztzhu1 commented 8 months ago

The original function _circuit_diagram_info_ of CustomizedCirqGate lacks a parameter called args, which will cause TypeError when cirq invokes this function.

refraction-ray commented 8 months ago

thanks for the contribution, is this a cirq version related bug? since in https://github.com/tencent-quantum-lab/tensorcircuit/blob/master/tests/test_circuit.py#L948 we have tested the customized gate. if there is cirq version difference for this arg, maybe (self, *args) is more flexible to pass both cases

ztzhu1 commented 8 months ago

thanks for the contribution, is this a cirq version related bug? since in https://github.com/tencent-quantum-lab/tensorcircuit/blob/master/tests/test_circuit.py#L948 we have tested the customized gate. if there is cirq version difference for this arg, maybe (self, *args) is more flexible to pass both cases

Aah, I didn't realize that. The version of my cirq is 1.2.0. Thanks for pointing out that😊. Should I close this PR and open a new one?

codecov[bot] commented 8 months ago

Codecov Report

Merging #188 (da04635) into master (56b44c5) will not change coverage. The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #188   +/-   ##
=======================================
  Coverage   75.51%   75.51%           
=======================================
  Files          67       67           
  Lines       10708    10708           
=======================================
  Hits         8086     8086           
  Misses       2622     2622           
Files Coverage Δ
tensorcircuit/translation.py 83.56% <100.00%> (ø)

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

refraction-ray commented 8 months ago

Aah, I didn't realize that. The version of my cirq is 1.2.0. Thanks for pointing out that😊. Should I close this PR and open a new one?

I think a further commit on your forked branch to define the function as (self, *args) is ok. the pr is auto linked no need to recreate a new pr

ztzhu1 commented 8 months ago

Aah, I didn't realize that. The version of my cirq is 1.2.0. Thanks for pointing out that😊. Should I close this PR and open a new one?

I think a further commit on your forked branch to define the function as (self, *args) is ok. the pr is auto linked no need to recreate a new pr

Thanks for your help! I have made a new commit :)

refraction-ray commented 8 months ago

LGTM, thanks for the contribution. @all-contributors please add @ztzhu1 for code

allcontributors[bot] commented 8 months ago

@refraction-ray

I couldn't determine any contributions to add, did you specify any contributions? Please make sure to use valid contribution names.

I've put up a pull request to add @ztzhu1! :tada: