TensorNetwork icon indicating copy to clipboard operation
TensorNetwork copied to clipboard

Add `item` for Tensor

Open alewis opened this issue 5 years ago • 6 comments

Tensor should support the numpy-like function item, which converts a size-1 Tensor into a Python scalar.

alewis avatar Sep 29 '20 12:09 alewis

May i work on this issue?

Sanchayan-Bhowal avatar Oct 11 '20 03:10 Sanchayan-Bhowal

Sure, sounds great!

alewis avatar Oct 11 '20 13:10 alewis

Actually I am new to GitHub. I have forked the issue and cloned it to my pc. Can u please guide me how to edit the code?

Sanchayan-Bhowal avatar Oct 13 '20 04:10 Sanchayan-Bhowal

Hey @Sanchayan-Bhowal, thanks for your contribution!

The workflow is as follows:

  1. create a fork of the TensorNetwork repository
  2. locally clone the fork to your computer:
    • $ git clone <your fork>
  3. create a new branch for your PR: $ git checkout -b <my PR branch> master
  4. fetch latest changes:
    • $ git fetch upstream
    • $ git merge upstream/master
  5. add your changes to the code
  6. commit and publish your changes:
    • $ git commit -a (commits all changes in a single commit, usually not ideal)
    • $ git push
  7. on the gitub page of your fork, select Pull Request at the top, and submit a new PR

mganahl avatar Oct 13 '20 10:10 mganahl

@mganahl Thank you so much I will try to fix this issue as soon as possible

Sanchayan-Bhowal avatar Oct 14 '20 05:10 Sanchayan-Bhowal

@alewis I have generated a pull request and added a function please check it out

Sanchayan-Bhowal avatar Oct 14 '20 06:10 Sanchayan-Bhowal