pytorch
64de93d8 - Move log_normal to Aten(CPU) (#31854)

Commit
4 years ago
Move log_normal to Aten(CPU) (#31854) Summary: Fix https://github.com/pytorch/pytorch/issues/24723. 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.log_normal_() 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.log_normal_() 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.0114 (ms). input size(128, 10) forward time is 0.1021 (ms). input size(128, 100) forward time is 1.0081 (ms). input size(128, 1000) forward time is 10.1831 (ms). ``` After: ``` input size(128, 1) forward time is 0.0108 (ms). input size(128, 10) forward time is 0.0969 (ms). input size(128, 100) forward time is 0.9804 (ms). input size(128, 1000) forward time is 9.6131 (ms). ``` Pull Request resolved: https://github.com/pytorch/pytorch/pull/31854 Differential Revision: D19314586 Pulled By: pbelevich fbshipit-source-id: 2ea1d9a2c505e36aca9e609b52ccb3e8caf2ba8f
Author
Parents
Loading