Skip to content

provide a nicer API for accessing the proper member of TensorProto #4261

@garymm

Description

@garymm

Currently code like this is repeated several times:

field = mapping.STORAGE_TENSOR_TYPE_TO_FIELD[
    mapping.TENSOR_TYPE_TO_STORAGE_TENSOR_TYPE[data_type]]
getattr(tensor, field)

This is repetitive and can be encapsulated in a helper function.
Also the name "storage tensor type" is misleading and has led to at least one bug.

We should:

  1. Add a function that does all this
  2. Deprecate mapping.STORAGE_TENSOR_TYPE_TO_FIELD and mapping.TENSOR_TYPE_TO_STORAGE_TENSOR_TYPE. Ideally log a warning when they're accessed.
  3. Eventually, then in the next release, remove those fields entirely.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions