569bfbb5af6f9b0355f3ec0058e3f57495e60953,gpytorch/functions/add_diag.py,AddDiag,forward,#AddDiag#Any#Any#,6
Before Change
raise RuntimeError("Input must be a single-element tensor")
val = diag.squeeze()[0]
return torch .eye(*input.size()).type_as(input).mul_(val).add_(input)
def backward(self, grad_output):
input_grad = None
After Change
diag_mat = torch.eye(input.size(-2), input.size(-1)).type_as(input)
if input.ndimension() == 3:
diag_mat = diag_mat.unsqueeze(0).expand_as(input)
return diag_mat.mul_(val).add_(input)
def backward(self, grad_output):
input_grad = None
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 3
Instances Project Name: cornellius-gp/gpytorch
Commit Name: 569bfbb5af6f9b0355f3ec0058e3f57495e60953
Time: 2018-01-10
Author: gpleiss@gmail.com
File Name: gpytorch/functions/add_diag.py
Class Name: AddDiag
Method Name: forward
Project Name: ruotianluo/self-critical.pytorch
Commit Name: bcdec7cdfadef83ea07a918a973aba4220177eaf
Time: 2020-04-02
Author: rluo@ttic.edu
File Name: models/AttModel.py
Class Name: AttModel
Method Name: _sample