d5604eaba321c11c1b9616c283262c4ddea55049,rllib/models/torch/modules/relative_multi_head_attention.py,RelativeMultiHeadAttention,forward,#RelativeMultiHeadAttention#Any#Any#,70
Before Change
Tau = list(memory.shape)[1] if memory is not None else 0
if memory is not None:
memory.requires_grad_(False)
inputs = torch.cat((memory, inputs), dim=1)
// Apply the Layer-Norm.
if self._input_layernorm is not None:
inputs = self._input_layernorm(inputs)
After Change
score = score / d**0.5
// causal mask of the same length as the sequence
mask = sequence_mask(
torch.arange(Tau + 1, Tau + T + 1),
dtype=score.dtype).to(score.device)
mask = mask[None, :, :, None]
masked_score = score * mask + 1e30 * (mask.float() - 1.)
wmat = nn.functional.softmax(masked_score, dim=2)
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 3
Instances Project Name: ray-project/ray
Commit Name: d5604eaba321c11c1b9616c283262c4ddea55049
Time: 2020-12-21
Author: sven@anyscale.io
File Name: rllib/models/torch/modules/relative_multi_head_attention.py
Class Name: RelativeMultiHeadAttention
Method Name: forward
Project Name: arraiy/torchgeometry
Commit Name: 2f49884ff8169422cbb711e18e94464efc59789c
Time: 2019-05-04
Author: edgar.riba@gmail.com
File Name: torchgeometry/core/pinhole.py
Class Name:
Method Name: normalize_pixel_coordinates
Project Name: cornellius-gp/gpytorch
Commit Name: a87490a4e2da7ca6a0efcbed3b65b6199499f833
Time: 2019-01-02
Author: kaw293@cornell.edu
File Name: gpytorch/lazy/cat_lazy_tensor.py
Class Name: CatLazyTensor
Method Name: _get_indices
Project Name: cornellius-gp/gpytorch
Commit Name: ae0da2426fd2efc57f4434dbcddf1af11bf5aac6
Time: 2019-03-18
Author: gpleiss@gmail.com
File Name: gpytorch/lazy/cat_lazy_tensor.py
Class Name: CatLazyTensor
Method Name: _getitem