Skip to content

NumpyTensor#2913

Merged
iamtrask merged 20 commits intomasterfrom
numpy_tensor2
Jan 16, 2020
Merged

NumpyTensor#2913
iamtrask merged 20 commits intomasterfrom
numpy_tensor2

Conversation

@iamtrask
Copy link
Member

I have created a new tensor type called NumpyTensor which will allow us to combine all tensors which utilize numpy tensors under the hood into a single abstraction.

I have initialized it with some basic functionality and future pull requests can extend it with more.

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

You'll be able to see Jupyter notebook diff and discuss changes. Powered by ReviewNB.

Copy link
Contributor

@LaRiffle LaRiffle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been dreaming of this last week! 🚀

@karlhigley karlhigley added the Type: Refactor 🔨 A complete overhaul of a file, feature, or codebase label Jan 16, 2020
Copy link
Contributor

@LaRiffle LaRiffle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's really helpful abstraction!

One last thing you can to if you want is add a method to NatvieTensor to transform a Torch Tensor to NympuTensor:

Exaample

x = th.tensor([1.])
x.numpy_tensor()

If yoo find a usecase for it

@iamtrask
Copy link
Member Author

That's really helpful abstraction!

One last thing you can to if you want is add a method to NatvieTensor to transform a Torch Tensor to NympuTensor:

Exaample

x = th.tensor([1.])
x.numpy_tensor()

If yoo find a usecase for it

Done

@iamtrask iamtrask merged commit a43a21f into master Jan 16, 2020
@iamtrask iamtrask deleted the numpy_tensor2 branch January 16, 2020 17:53
"""Initializes a HookedTensor.

Args:
numpy_tensor (np.array): The numpy array which this tensor should wrap.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey I'm new here, but I dont see a numpy_tensor argument?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whoops - looks like a mistake. PR welcome :)

@vishalsubbiah vishalsubbiah mentioned this pull request Jan 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Refactor 🔨 A complete overhaul of a file, feature, or codebase

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants