Giter VIP home page Giter VIP logo

Comments (7)

karkir0003 avatar karkir0003 commented on July 28, 2024

@szagoruyko @willprice

from pytorchviz.

albanD avatar albanD commented on July 28, 2024

Hi,

The from_numpy() call looks very suspicious here! If pred is a numpy array, it cannot have autograd info associated with it.

from pytorchviz.

karkir0003 avatar karkir0003 commented on July 28, 2024

so the .from_numpy() bascially converts numpy array into torch.tensor

from pytorchviz.

karkir0003 avatar karkir0003 commented on July 28, 2024

how can I remedy this issue? @albanD

from pytorchviz.

karkir0003 avatar karkir0003 commented on July 28, 2024

so when I do predict on the model, am I to return the prediction as a torch tensor?

from pytorchviz.

karkir0003 avatar karkir0003 commented on July 28, 2024

Also, one other question I have is this:

Suppose that my model architecture is of the form:

import torch
import torch.nn as nn
from torch.autograd import Variable

class DLModel(nn.Module):
    def __init__(self, layer_list):
        """
        Function to initialize Deep Learning model
        given a user specified layer list

        Args:
            layer_list (list): list of nn.Module layers from parser.py
        """
        super().__init__()
        self.model = nn.Sequential(*layer_list)
    
    def forward(self, x: torch.Tensor):
        pred = self.model(x) #apply model on input x
        return pred

How can I use pytorchviz to visualize the model architecture where we want to see each layer/module in nn.Sequential? @albanD @szagoruyko

from pytorchviz.

albanD avatar albanD commented on July 28, 2024

so when I do predict on the model, am I to return the prediction as a torch tensor?

PyTorch autograd and training in general will only work with torch Tensors. So yes, you will have to use Tensor to be able to train this model and to visualize it as well.

How can I use pytorchviz to visualize the model architecture where we want to see each layer/module in nn.Sequential?

If you want nn.Module as well, I would recommend torchrecorder: https://torchrecorder.readthedocs.io/en/latest/

from pytorchviz.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.