Skip to content

Unexpected cuda allocate in the knn_points function #1922

Open
@pengc02

Description

@pengc02

Hi guys, I met a problem here:

import torch
from pytorch3d.ops import knn_points
import ipdb
points = torch.rand(1000, 3)
device = "cuda"

with torch.no_grad():
    fused_point_cloud = points.float().to(device)
    dist2 = torch.clamp_min(
        knn_points(fused_point_cloud[None], fused_point_cloud[None], K=4)[0][0, :, 1:].mean(-1),
        1e-7
    ).cpu().detach().clone()
    fused_point_cloud = fused_point_cloud.cpu().detach().clone()
    
ipdb.set_trace()

image

As i move all the variables to cpu, there should not be any cuda allocate, however there is still some cuda memory allocate when it runs to the 'ipdb.set_trace()'. I wonder if it's a bug or just i missused something.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions