question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Optional FixedPointSampling without Replacement

See original GitHub issue

🐛 Bug

To Reproduce

Steps to reproduce the behavior:

……
    def forward(self, data):
        pos, batch = data.pos, data.batch
        
        N = len(pos)
        psid, ptid = knn_graph(pos, self.k, batch, loop=False, flow=self.flow) # edge_index:[E, 2]
……

image

Expected behavior

N * K == len(ptid)

Environment

  • OS: Colab Linux
  • Python version: 3
  • PyTorch version: 1.2.0
  • CUDA/cuDNN version: 10.0
  • GCC version:
  • Any other relevant information:

Additional context

data comes from shapenet and FixedPoints(2048)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:19 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
WMF1997commented, Aug 25, 2019

hello @rusty1s: it is just a type error in the batch line. .long()) should be .long() he typed one more ‘)’

and the code should be

with my result.

image

and hello @cy69855522

image

In [1]: import torch_geometric
INFO:rdflib:RDFLib Version: 4.2.2
D:\ProgramData\Anaconda3\lib\site-packages\h5py\__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters

In [2]: import torch_geometric.transforms as gtransforms

In [3]: import torch_geometric.datasets as gdatasets

In [4]: m10 = gdatasets.ModelNet('./ModelNet/ModelNet10/')

In [5]: m10_0 = m10[0]

In [6]: m10_0
Out[6]: Data(face=[3, 30734], pos=[18472, 3], y=[1])

In [7]: knn = gtransforms.KNNGraph(k=4)

In [8]: mm = knn(m10_0)

In [9]: mm
Out[9]: Data(edge_index=[2, 73888], face=[3, 30734], pos=[18472, 3], y=[1])

In [10]: 18472*4
Out[10]: 73888

In my code, I do not think there is a question on knn_graph’s flow is source_to_target, I picked up the index, showing that it is okay.

In [15]: mm.edge_index[1][:14]
Out[15]: tensor([0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3])

and I do not test the batch, perhaps it is the same.

yours sincerely, @wmf1997

0reactions
rusty1scommented, Sep 12, 2019

Yes, you are right 😃 Sorry!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Sampling with replacement
In sampling without replacement, the two sample values aren't independent. Practically, this means that what we got on the for the first one...
Read more >
Ordered samples without replacement - YouTube
Many problems in combinatorics resolve to asking how many samples of a certain type may be collected from some universe.
Read more >
34.2 - Random Sampling with Replacement | STAT 482
In general, with the POINT= option, you name a temporary variable (here, choose) whose value is the number of the observation you want...
Read more >
Chapter 5 Choosing the Type of Probability Sampling
There are two types of simple random sampling: sampling with replacement and sampling without replacement. In sampling with replacement, after an element has ......
Read more >
On the non‐recursive implementation of multistage sampling ...
Multistage sampling without replacement as formalized by recurrence formula (1) may be implemented using Algorithm 8 which generates an ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found