{"href":"https://api.simplecast.com/oembed?url=https%3A%2F%2Fpytorch-dev-podcast.simplecast.com%2Fepisodes%2Freference-counting-a3yF3fEQ","width":444,"version":"1.0","type":"rich","title":"Reference counting","thumbnail_width":300,"thumbnail_url":"https://image.simplecastcdn.com/images/8cefde76-fb46-406a-8d87-ab0df67f3423/92f11400-2dad-49b4-8b14-cce35f5ab765/pytorch-symbol-02-orangeondark.jpg","thumbnail_height":300,"provider_url":"https://simplecast.com","provider_name":"Simplecast","html":"<iframe src=\"https://player.simplecast.com/799ed542-8b1b-49d1-8080-5a0bcc8f7b0d\" height=\"200\" width=\"100%\" title=\"Reference counting\" frameborder=\"0\" scrolling=\"no\"></iframe>","height":200,"description":"Reference counting is a common memory management technique in C++ but PyTorch does its reference counting in a slightly idiosyncratic way using intrusive_ptr. We'll talk about why intrusive_ptr exists, the reason why refcount bumps are slow in C++ (but not in Python), what's up with const Tensor& everywhere, why the const is a lie and how TensorRef lets you create a const Tensor& from a TensorImpl* without needing to bump your reference count."}