Skip to content

Expand(), memory keeps increasing #2148

@IouJenLiu

Description

@IouJenLiu

When I run the following code, the memory usage keeps increasing iteration by iteration.

while True:
  a = Variable(torch.FloatTensor(32,16).cuda())  
  r = Variable(torch.FloatTensor(1).cuda())
  c = r.expand(a.size())

If I use r.exapnd([32, 16]), memory usage does not increase.
Did I use expand() incorrectly? Does anyone have the same issue?

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