[Python] What is the best method when importing submodule from a parent module in Python

Discussão em 'Python' iniciado por Stack, Maio 9, 2025.

  1. Stack

    Stack Membro Participativo

    in many DL implementations in Python, I see two types of definitions when importing a submodule:

    from torchvision import transforms

    and

    import torchvision.transforms as transforms

    I want to know if they are really equivalent. I know if I want to rename the submodule to something else I should use the 2nd one, but is there any issues regarding speed and memory in any of the two methods?

    Continue reading...

Compartilhe esta Página