What is the purpose of "torch.Tensor.name" attribute?

Hi.

While trying named tensors,
I found torch.Tensor have attribute ‘name’.
It prints None, and also is not writable.
I think there is no documentation for this…

Can you help me understand what ‘name’ does?

Hi,
Documentation is available for named tensor:

  1. Named Tensor
  2. Named Tensor Tutorial
1 Like

Thanks. But I’m pretty sure ‘name’ is not related to named tensors…

I can access tensor names by ‘torch.Tensor.names’ for named tensors. [‘N’, ‘C’, …]
But ‘torch.Tensor.name’ is still None for named tensors.

Yes, you are right tensor.name returns always None and there doesn’t seem to be a documentation for it. In tensorflow tensor.name gives name of variable/tensor in graph execution. Sorry for mis-direction.

Based on this comment it seems tensor.name is currently used in ONNX (but I’m not sure how and where).

1 Like

At the same time, the rename method seems to update the names attribute, not the name attribute. So it seems like the most reasonable name for a method that renames a tensor is already taken by a method that changes its dimension names.