TensorNetwork icon indicating copy to clipboard operation
TensorNetwork copied to clipboard

Support real and imag at the backend level

Open alewis opened this issue 5 years ago • 13 comments

alewis avatar Sep 28 '20 12:09 alewis

Hi @alewis, Any ideas on how to tackle this?

ahmedkrmn avatar Oct 01 '20 17:10 ahmedkrmn

For every backend except PyTorch, I think .real and .imag are harmless when applied to real input, so in those cases we can just wrap the relevant function. PyTorch will require some special handling. I guess a simple try / except would work?

On Thu, Oct 1, 2020 at 1:03 PM Ahmed Karaman [email protected] wrote:

Hi @alewis https://github.com/alewis, Any ideas on how to tackle this?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/google/TensorNetwork/issues/841#issuecomment-702271385, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAINHBS7YWOUO7H6JCJ7CHTSISY5TANCNFSM4R4PC7TA .

alewis avatar Oct 01 '20 17:10 alewis

Hey, Is this issue still still open?

MikeMerz avatar Oct 08 '20 13:10 MikeMerz

Yep, this one is, though I don't know whether @ahmedkrmn is working on it?

alewis avatar Oct 08 '20 14:10 alewis

@MikeMerz, feel free to work on it if you want to. I've been busy lately so I still haven't started.

ahmedkrmn avatar Oct 10 '20 12:10 ahmedkrmn

@ahmedkrmn Thanks mate. @alewis Just a thought: 1)For numpy and tensorflow backends, it's possible to just to call numpy and tensor's .real and .imag? as the input is of the same type.

MikeMerz avatar Oct 10 '20 16:10 MikeMerz

Yes, that should work in all cases except PyTorch and Symmetric. For PyTorch you'll need to do some additional type checking because calling . real and .imag throws an error for non complex input in that case.

On Sat, Oct 10, 2020, 12:26 MikeMerz [email protected] wrote:

@ahmedkrmn https://github.com/ahmedkrmn Thanks mate. Just a though: 1)For numpy and tensorflow backends, it's possible to just to call numpy and tensor's .real and .imag? as the input is of the same type.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/google/TensorNetwork/issues/841#issuecomment-706574826, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAINHBTSARWHKVUX6PP6W6TSKCDMNANCNFSM4R4PC7TA .

alewis avatar Oct 10 '20 16:10 alewis

@alewis For PyTorch, is it better to raise an excpetion if the input is not complex or treat it as 0j?

MikeMerz avatar Oct 10 '20 17:10 MikeMerz

I think the latter, yeah.

On Sat, Oct 10, 2020, 13:22 MikeMerz [email protected] wrote:

For PyTorch, is it better to raise an excpetion if the input is not complex or treat it as 0j?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/google/TensorNetwork/issues/841#issuecomment-706583344, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAINHBTRMYYG76K67CQM4JLSKCJ65ANCNFSM4R4PC7TA .

alewis avatar Oct 10 '20 20:10 alewis

@alewis Hey, I unintentionally pushed the changes of this Issue to the ones_like and zero_like Pull request

MikeMerz avatar Oct 11 '20 17:10 MikeMerz

Hmm, do you think you can revert it and split them up?

On Sun, Oct 11, 2020, 13:39 MikeMerz [email protected] wrote:

@alewis https://github.com/alewis Hey, I unintentionally pushed the changes of this Issue to the ones_like and zero_like Pull request

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/google/TensorNetwork/issues/841#issuecomment-706740113, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAINHBV34EXQEYSG6AXYDFLSKHUWTANCNFSM4R4PC7TA .

alewis avatar Oct 11 '20 19:10 alewis

@alewis after much tries, I re-uploaded the changes for the ones_like & zero_like issue , had to close the last request

MikeMerz avatar Oct 12 '20 14:10 MikeMerz

Heyy @MikeMerz , @alewis I am a new contributor can i take up thi s?? and can someone provide little heads-up or description about this issue??

AnuravModak avatar Aug 20 '23 06:08 AnuravModak