Skip to content

Remove caching from torch information endpoint - #472

Merged
ev-br merged 1 commit into
data-apis:mainfrom
betatim:remove-caching-for-torch
Aug 27, 2026
Merged

Remove caching from torch information endpoint#472
ev-br merged 1 commit into
data-apis:mainfrom
betatim:remove-caching-for-torch

Conversation

@betatim

@betatim betatim commented Aug 27, 2026

Copy link
Copy Markdown
Member

The @cache decorator was not working so we remove it. Because it uses self as part of they key each new instance had a new fresh cache. And basically you get a new instance every time.

Closes #470

The cache was not working so we remove it.
Copilot AI lite review requested due to automatic review settings August 27, 2026 13:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Removes functools.cache-based memoization from the PyTorch __array_namespace_info__ inspection namespace because it was ineffective in common usage patterns (new __array_namespace_info__ instances led to cache misses).

Changes:

  • Drop from functools import cache import.
  • Remove @cache decorators from dtypes() and devices() in the PyTorch info namespace.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@lucascolley
lucascolley requested a review from ev-br August 27, 2026 13:32
@ev-br
ev-br merged commit 56c26fe into data-apis:main Aug 27, 2026
28 checks passed
@betatim
betatim deleted the remove-caching-for-torch branch August 27, 2026 13:45
@ev-br

ev-br commented Aug 27, 2026

Copy link
Copy Markdown
Member

LGTM and CI is green and it's merged. Thanks @betatim

@ev-br ev-br added this to the 1.16 milestone Aug 27, 2026
@betatim

betatim commented Aug 27, 2026

Copy link
Copy Markdown
Member Author

Out of interest: where/how is it configured that copilot comes and reviews? And can you configure copilot to tell it things about how to review?

@ev-br

ev-br commented Aug 27, 2026

Copy link
Copy Markdown
Member

Yeah, we should prbably just disable these automated Copilot revews
Based on https://github.com/orgs/community/discussions/189857, there's a hierarchy of org level > repo level > user level. For the first two, we need to ask the admins. @kgryte or @rgommers -- could you please disable Copilot reviews for the data-apis org and the array-api-compat repository?

@rgommers

Copy link
Copy Markdown
Member

Disabled at the repo level. There is no org-level setting for Copilot it looks like.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PyTorch namespace info caching doesn't work

4 participants