mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
Context: https://github.com/pytorch/torchdynamo/issues/1588 This PR moves [TorchDynamo](https://github.com/pytorch/torchdynamo) and TorchInductor into PyTorch core. - `torchdynamo` becomes `torch._dynamo` - `torchinductor` becomes `torch._inductor` This PR was generated by running `copy_to_core.sh` in https://github.com/pytorch/torchdynamo/pull/1538 Pull Request resolved: https://github.com/pytorch/pytorch/pull/86461 Approved by: https://github.com/voznesenskym
20 lines
488 B
Python
20 lines
488 B
Python
import math
|
|
|
|
import torch
|
|
|
|
|
|
def rounded_linspace(low, high, steps, div):
|
|
ret = torch.linspace(low, high, steps)
|
|
ret = (ret.int() + div - 1) // div * div
|
|
ret = torch.unique(ret)
|
|
return list(map(int, ret))
|
|
|
|
|
|
def powspace(start, stop, pow, step):
|
|
start = math.log(start, pow)
|
|
stop = math.log(stop, pow)
|
|
steps = int((stop - start + 1) // step)
|
|
ret = torch.pow(pow, torch.linspace(start, stop, steps))
|
|
ret = torch.unique(ret)
|
|
return list(map(int, ret))
|