Skip to content

torch_to_nnef.tensor.named

Classes:

Name Description
NamedTensor

Tensor enriched with name attribute.

Functions:

Name Description
apply_name_to_tensor_in_module

Transform torch.Tensor or Parameters into NamedTensor.

NamedTensor

NamedTensor(fp_tensor: Tensor, nnef_name: str)

Bases: Tensor

Tensor enriched with name attribute.

Attributes:

Name Type Description
data

Very important to keep access to all special attr of NamedTensor.

data property writable

data

Very important to keep access to all special attr of NamedTensor.

apply_name_to_tensor_in_module

apply_name_to_tensor_in_module(model: Module)

Transform torch.Tensor or Parameters into NamedTensor.

This is applied at export time of torch_to_nnef Just before doing any tracing and allow to keep variable naming identical to PyTorch one

This consistent naming unlock subsequent manipulations such as LORA applications @ inference or such.