pytorch
e59e5ba5 - Move geometric to Aten(CPU) (#31878)

Commit
4 years ago
Move geometric to Aten(CPU) (#31878) Summary: Fix https://github.com/pytorch/pytorch/issues/24704. 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.geometric_(0.5) 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.geometric_(0.5) 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.0092 (ms). input size(128, 10) forward time is 0.0802 (ms). input size(128, 100) forward time is 0.7994 (ms). input size(128, 1000) forward time is 7.8403 (ms). ``` After: ``` input size(128, 1) forward time is 0.0088 (ms). input size(128, 10) forward time is 0.0781 (ms). input size(128, 100) forward time is 0.7815 (ms). input size(128, 1000) forward time is 7.7163 (ms). ``` Pull Request resolved: https://github.com/pytorch/pytorch/pull/31878 Differential Revision: D19314510 Pulled By: ezyang fbshipit-source-id: 2d95bf9938c8becf280890acf9e37223ddd08a39
Author
Parents
Loading