Skip to content

Meta type class defining tensor shapes #2

@addisonklinke

Description

@addisonklinke

Is your feature request related to a problem? Please describe
To clearly define the expected inputs/outputs for a given nn.Module, it would be convenient to create a wrapper class for torch.Tensor that encapsulates shape schema and allows for comparisons

Describe the solution you'd like
Create a class called torcharch.types.TensorShape which is initialized with the tensor dimensionality as well any restrictions on the valid range of values each dimension can take on. This can be useful for several cases

  1. Custom modules should define a valid input/output @property
  2. End users can use this interface to check their work
  3. Schema can also be used to conduct dynamic unit tests

Describe alternatives you've considered

  1. The main alternative would be using the built-in tensor class to define a dummy example. However, this is limiting in that the object can't contain schema information about the acceptable range of values in each dimension
  2. It does not appear that PyTorch includes a class like this currently, although that would be preferable

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions