Return the cached cosine value for the given position and sequence length. When `device` differs from the cache's own device, the result is copied to that device (enables multi-GPU workers).
(&self, index_pos: usize, seq_len: usize, device: &Device)
| 138 | /// When `device` differs from the cache's own device, the result is copied |
| 139 | /// to that device (enables multi-GPU workers). |
| 140 | pub fn cosine(&self, index_pos: usize, seq_len: usize, device: &Device) -> Result<Tensor> { |
| 141 | self.cos.narrow(0, index_pos, seq_len)?.to_device(device) |
| 142 | } |
| 143 | |
| 144 | /// Return the cached sine value for the given position and sequence length. |
| 145 | pub fn sine(&self, index_pos: usize, seq_len: usize, device: &Device) -> Result<Tensor> { |
no outgoing calls