pytorch/torch/nn/_functions/vision.py
David Riazati f3cc9b2218 Remove fully qualified weak script names (#15364)
Summary:
Cleanup to make references to `weak_script` consistent across codebase
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15364

Differential Revision: D13509676

Pulled By: driazati

fbshipit-source-id: 93dbbbe57e9b9b6587895f3cc6fac678babd21de
2018-12-18 16:48:52 -08:00

15 lines
451 B
Python

import torch
import torch.backends.cudnn as cudnn
from ..._jit_internal import weak_script
@weak_script
def affine_grid_generator(theta, size):
# type: (Tensor, List[int]) -> Tensor
if theta.is_cuda and cudnn.enabled and cudnn.is_acceptable(theta) and len(size) == 4:
N, C, H, W = size
ret = torch.cudnn_affine_grid_generator(theta, N, C, H, W)
else:
ret = torch.affine_grid_generator(theta, size)
return ret