pytorch
9a3cb1e8 - Move cauchy to Aten(CPU) (#31824)

Commit
4 years ago
Move cauchy to Aten(CPU) (#31824) Summary: Fix https://github.com/pytorch/pytorch/issues/24684. Benchmark script : ``` import torch import torch.nn as nn import time torch.manual_seed(0) def _time(): return time.time() device = "cpu" #warm up for n in [10, 100, 1000]: input = torch.randn(128, n, requires_grad=False, device=device) for i in range(1000): input.cauchy_() for n in [1, 10, 100, 1000]: fwd_t = 0 input = torch.randn(128, n, requires_grad=False, device=device) for i in range(10000): t1 = _time() input.cauchy_() t2 = _time() fwd_t = fwd_t + (t2 -t1) fwd_avg = fwd_t / 10000 * 1000 print("input size(128, %d) forward time is %.4f (ms)." % (n, fwd_avg)) ``` Test device: **skx-8180**. Before: ``` input size(128, 1) forward time is 0.0071 (ms). input size(128, 10) forward time is 0.0596 (ms). input size(128, 100) forward time is 0.5798 (ms). input size(128, 1000) forward time is 5.8395 (ms). ``` After: ``` input size(128, 1) forward time is 0.0070 (ms). input size(128, 10) forward time is 0.0583 (ms). input size(128, 100) forward time is 0.5714 (ms). input size(128, 1000) forward time is 5.7674 (ms). ``` Pull Request resolved: https://github.com/pytorch/pytorch/pull/31824 Differential Revision: D19314411 Pulled By: ezyang fbshipit-source-id: 58098546face3e5971b023f702cfe44ff1cccfbc
Author
Parents
Loading