TrainingExtensions/torch/src/python/aimet_torch/meta/connectedgraph.py
def _get_module_tensor_shapes_entry(tensors: Union[torch.Tensor, List, Dict, None]):
    """
    Given the tensor input or output for a module, extract their shapes and return the shapes in the same list structure
    as the given tensor.
    :param tensors: Input or output tensors for a module
    :return: Shapes of the constituent tensors in tensors
    """
    if tensors is None:
        return None
    if isinstance(tensors, torch.Tensor):
        return tensors.shape
    # Tensors must then be a nested list of tensors, so recursively get the shapes for each item in the list
    if isinstance(tensors, (List, Tuple)):
        return [_get_module_tensor_shapes_entry(entry) for entry in tensors]
    if isinstance(tensors, Dict):
        shapes_dict = {}
        for k, v in tensors.items():
            shapes_dict[k] = _get_module_tensor_shapes_entry(v)
        return shapes_dict
    logger.debug('Unexpected data type for tensor %s. Supported types include tensors, or Lists, Tuples, and Dicts of '
                 'tensors.', type(tensors))
    return None

    Given the tensor input or output for a module, extract their shapes and return the shapes in the same list structure
    as the given tensor.
    :param tensors: Input or output tensors for a module
    :return: Shapes of the constituent tensors in tensors
    
Given the tensor input or output for a module, extract their shapes and return the shapes in the same list structure
as the given tensor.
Given the tensor input or output for a module extract their shapes and return the shapes in the same list structure as the given tensor .
def _get_module_tensor_shapes_entry(tensors: Union[torch.Tensor, List, Dict, None]):
    if tensors is None:
        return None
    if isinstance(tensors, torch.Tensor):
        return tensors.shape
    if isinstance(tensors, (List, Tuple)):
        return [_get_module_tensor_shapes_entry(entry) for entry in tensors]
    if isinstance(tensors, Dict):
        shapes_dict = {}
        for k, v in tensors.items():
            shapes_dict[k] = _get_module_tensor_shapes_entry(v)
        return shapes_dict
    logger.debug('Unexpected data type for tensor %s. Supported types include tensors, or Lists, Tuples, and Dicts of '
                 'tensors.', type(tensors))
    return None
def _get_module_tensor_shapes_entry ( tensors : Union [ torch . Tensor , List , Dict , None ] ) : if tensors is None : return None if isinstance ( tensors , torch . Tensor ) : return tensors . shape if isinstance ( tensors , ( List , Tuple ) ) : return [ _get_module_tensor_shapes_entry ( entry ) for entry in tensors ] if isinstance ( tensors , Dict ) : shapes_dict = { } for k , v in tensors . items ( ) : shapes_dict [ k ] = _get_module_tensor_shapes_entry ( v ) return shapes_dict logger . debug ( 'Unexpected data type for tensor %s. Supported types include tensors, or Lists, Tuples, and Dicts of ' 'tensors.' , type ( tensors ) ) return None
Given the tensor input or output for a module, extract their shapes and return the shapes in the same list structure
as the given tensor.
Given the tensor input or output for a module extract their shapes and return the shapes in the same list structure as the given tensor .
"""
    Given the tensor input or output for a module, extract their shapes and return the shapes in the same list structure
    as the given tensor.
    :param tensors: Input or output tensors for a module
    :return: Shapes of the constituent tensors in tensors
    """ # Tensors must then be a nested list of tensors, so recursively get the shapes for each item in the list
Shapes of the constituent tensors in tensors
Shapes of the constituent tensors in tensors
tensors
Union[torch.Tensor, List, Dict, None]
Input or output tensors for a module
Input or output tensors for a module