Skip to content
Advertisement

Tag: memory

Why does GPU memory increase when recreating and reassigning a JAX numpy array to the same variable name?

When I recreate and reassign a JAX np array to the same variable name, for some reason the GPU memory nearly doubles the first recreation and then stays stable for subsequent recreations/reassignments. Why does this happen and is this generally expected behavior for JAX arrays? Fully runnable minimal example: https://colab.research.google.com/drive/1piUvyVylRBKm1xb1WsocsSVXJzvn5bdI?usp=sharing. For posterity in case colab goes down: Thank you! Answer

How are small sets stored in memory?

If we look at the resize behavior for sets under 50k elements: This pattern is consistent with quadrupling of the backing storage size once the set is 3/5ths full, plus some presumably constant overhead for the PySetObject: A similar pattern continues even for larger sets, but the resize factor switches to doubling instead of quadrupling. The reported size for small

Why list([]) weighs less than []

I have such code: With the next result: The question is: Why does a list created with list([]) weigh less than a list created with just [] or for _ in condition? Answer (The details in this answer depend on the implementation, they are written to match CPython 3.10.0. Other versions or other implementations of Python work differently.) Lists in

Python memory release when using a for loop inside a class

I have some troubles after I created a class to process raster images. The class includes different methods for checking DBs and processing the images. The usage script is super simple: The method run_extraction() is the following: The method does several steps for getting an observation for a given variable. The code works, but it doesn’t release memory. Since it’s

Closing figures from previous sessions

I am running a python code that produces some figures with Matplotlib and Pandas. After a few runs of the code, I am getting to following error: RuntimeWarning: More than 20 figures have been opened. Figures created through the pyplot interface (matplotlib.pyplot.figure) are retained until explicitly closed and may consume too much memory. (To control this warning, see the rcParam

Why tensor size was not changed?

I made the toy CNN model. Then, I had checked model.summary via this code And I was able to get the following results: I want to reduce model size cuz i wanna increase the batch size. So, I had changed torch.float32 -> torch.float16 via NVIDIA/apex As a result, torch.dtype was changed torch.float16 from torch.float32. But, Param size (MB): 35.19 was

What for we call for the typing import List from the Python Standard Library?

I am solving some questions from the Leetcode: https://leetcode.com/problems/remove-duplicates-from-sorted-array/ I find the answers: Given a sorted array, remove the duplicates in-place such that each element appear only once and return the new length The answer for this question can be, too: I can’t find the answer to the question of why in the code should be applied typing. On the

Advertisement