← Về thư mục
search_r1/llm_agent/tensor_helper.py
- TensorConfig · class · L6-L10 — class TensorConfig
- TensorHelper · class · L12-L75 — class TensorHelper
- init · method · L13-L14 — def init(self, config: TensorConfig)
- cut_to_effective_len · method · L16-L27 — def cut_to_effective_len(self, tensor_dict: Dict[str, torch.Tensor], keys: List[str], cut_left: bool = True) -> Dict[str, torch.Tensor]
- convert_pad_structure · method · L29-L33 — def convert_pad_structure(self, tensor: torch.Tensor, pad_to_left: bool = True) -> Tuple[torch.Tensor, torch.Tensor]
- create_attention_mask · method · L35-L37 — def create_attention_mask(self, input_ids: torch.Tensor) -> torch.Tensor
- create_position_ids · method · L39-L41 — def create_position_ids(self, attention_mask: torch.Tensor) -> torch.Tensor
- concatenate_with_padding · method · L43-L48 — def concatenate_with_padding(self, tensors: List[torch.Tensor], pad_to_left: bool = True) -> torch.Tensor
- _example_level_pad · method · L50-L75 — def _example_level_pad(self, responses: torch.Tensor, responses_str: List[str], active_mask: torch.Tensor) -> Tuple[torch.Tensor, List[str]]