Skip to content

Conversation

@jon-tow
Copy link
Contributor

@jon-tow jon-tow commented Oct 1, 2019

Adds torch::nn::functional::pdist module support for the C++ API.

Issue: #25883, #27082

Reviewer: @yf225

@pytorchbot pytorchbot added the module: cpp Related to C++ API label Oct 1, 2019

/// Computes the p-norm distance between every pair of row vectors in the input.
/// This function will be faster if the rows are contiguous.
inline Tensor pdist(const Tensor& input, int64_t p = 2) {
Copy link
Contributor

Choose a reason for hiding this comment

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

@jon-tow My sincere apologies - I made a mistake and just realized that p should be double type (https://en.wikipedia.org/wiki/Norm_(mathematics)#p-norm). Sorry for the inconvenience :(

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@yf225 Ah wow, good catch. I was also certain that p was integer rather than real.

Copy link
Contributor

@yf225 yf225 left a comment

Choose a reason for hiding this comment

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

@jon-tow Thanks for the great work! I will merge it first thing tomorrow morning :)

@jon-tow
Copy link
Contributor Author

jon-tow commented Oct 1, 2019

@yf225 You're welcome!

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@yf225 is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@yf225 merged this pull request in 18eea82.

@jon-tow jon-tow deleted the c++-api/pdist branch October 1, 2019 17:55
pdlive215 pushed a commit to pdlive215/pytorch that referenced this pull request Nov 27, 2019
Summary:
Adds `torch::nn::functional::pdist` module support for the C++ API.

Issue: pytorch#25883, pytorch#27082

Reviewer: yf225
Pull Request resolved: pytorch#27122

Differential Revision: D17685823

Pulled By: yf225

fbshipit-source-id: f8ceb09635385ef2e16a002e5fc255be8eb2ebf4
thiagocrepaldi pushed a commit to thiagocrepaldi/pytorch that referenced this pull request Feb 4, 2020
Summary:
Adds `torch::nn::functional::pdist` module support for the C++ API.

Issue: pytorch#25883, pytorch#27082

Reviewer: yf225
Pull Request resolved: pytorch#27122

Differential Revision: D17685823

Pulled By: yf225

fbshipit-source-id: f8ceb09635385ef2e16a002e5fc255be8eb2ebf4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants