ma-xu / Context-Cluster

[ICLR 2023 Oral] Image as Set of Points

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question about code implementation

Wzhjerry opened this issue · comments

Hello,

I hope this message finds you well. I wanted to start by commending you on your impressive work!

I have a question about the implementation of patch aggregation and dispatching in the "context_cluster.py" code. In lines 170-171 and 177, it appears that you are performing a matrix multiplication using value2 and sim. Specifically, the output out is calculated as value * sim = out, and the shape of each tensor is [b, n, d] * [b, m, n] = [b, m ,d]. I believe this is the process of patch aggregation and dispatching that you are referring to.

I also noticed that you did not use the "torch.bmm()" function for this implementation, which is generally used for matrix multiplication. Instead, you used a custom implementation. I am curious to know why you did not use "torch.bmm()", and whether there are any differences between your implementation and using "torch.bmm()".

I have actually done a short demo using "torch.bmm()", and it seems to save a lot of computation resources. I would appreciate it if you could share your thoughts on this.

Looking forward to your response.

commented

@Wzhjerry Thanks a lot for your detailed analysis and sorry that I didn't reply in time because I was really busy previously.

I didn't notice that. Please feel free to share your implementation and I can validate that. That would be greatly helpful to save computations. Thanks in advances.

Best,
Xu

commented

Closed no further discussions. Feel free to reopen it if any further questions.