Skip to content

Commit 68dfd44

Browse files
malfetpytorchmergebot
authored andcommitted
Do not depend on numpy during the import (pytorch#149683)
But a good followup would be to use torch primitives instead of numpy here Fixes pytorch#149681 Test plan: Monkey-patch 2.7.0-rc and run `python -c "import torch;print(torch.compile(lambda x:x.sin() + x.cos())(torch.rand(32)))"` Pull Request resolved: pytorch#149683 Approved by: https://github.com/seemethere
1 parent 3474367 commit 68dfd44

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

torch/_functorch/_activation_checkpointing/knapsack_evaluator.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from typing import Callable
33

44
import networkx as nx
5-
import numpy as np
65

76
from torch._functorch._activation_checkpointing.graph_info_provider import (
87
GraphInfoProvider,
@@ -237,6 +236,8 @@ def get_knee_point_memory_budget(
237236
Returns:
238237
float: Memory budget at the knee point.
239238
"""
239+
import numpy as np
240+
240241
results = self.evaluate_distribution_of_results_for_knapsack_algo(
241242
knapsack_algo=knapsack_algo,
242243
memory_budget_values=np.linspace( # type: ignore[arg-type]

0 commit comments

Comments
 (0)