Transform
columns_to_tensor
Convert the columns to a torch tensor.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
columns | 
List[str]
 | 
Columns for keyless reading.  | 
required | 
device | 
torch.device, default
 | 
The desired device of returned tensor.  | 
torch.device('cpu')
 | 
Returns:
| Name | Type | Description | 
|---|---|---|
tensor |  
Tensor[SEQUENCE_LEN, len(var.ALPHABET)]
 | 
Columns as a torch tensor.  | 
Source code in src/trecover/utils/transform.py
files_columns_to_tensors
Convert the batch of columns to torch tensors.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
files_columns | 
List[List[str]]
 | 
Batch of columns for keyless reading.  | 
required | 
device | 
torch.device, default
 | 
The desired device of returned tensor.  | 
torch.device('cpu')
 | 
Returns:
| Type | Description | 
|---|---|
List[Tensor]
 | 
Columns batch as a list of torch tensors.  | 
Source code in src/trecover/utils/transform.py
tensor_to_columns
Convert the columns' tensor representation to a list of strings with alphabet symbols.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
grid | 
Tensor[SEQUENCE_LEN, len(var.ALPHABET)]
 | 
Columns for keyless reading as a tensor.  | 
required | 
Returns:
| Type | Description | 
|---|---|
List[str]
 | 
Columns' tensor representation as a list of strings with alphabet symbols.  | 
Source code in src/trecover/utils/transform.py
tensor_to_target
Convert the target tensor representation to list of alphabet symbols.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
tgt | 
Tensor[SEQUENCE_LEN]
 | 
Target tensor representation of columns' correct symbols.  | 
required | 
Returns:
| Type | Description | 
|---|---|
List[str]
 | 
Target tensor representation to list of alphabet symbols.  |