![]() Torch.rand(self.num_layers, self.batch_size, self.hidden_size).to(device).detach()) Return (torch.rand(self.num_layers, self.batch_size, self.hidden_size).to(device).detach(), Lstm_out, (hidden_a, hidden_b) = self.lstm(x, (h0, c0)) Specifically, a numpy equivalent for the following would be great: It would help us compare the numpy output to torch output for the same code, and give us some modular code/functions to use. I think it might be useful to include the numpy/scipy equivalent for both nn.LSTM and nn.linear. So, the question is, how can I "translate" this RNN definition into a class that doesn't need pytorch, and how to use the state dict weights for it?Īlternatively, is there a "light" version of pytorch, that I can use just to run the model and yield a result? EDIT However, can I have some implementation for the nn.LSTM and nn.Linear using something not involving pytorch? Also, how will I use the weights from the state dict into the new class? I think I can easily implement the sigmoid function using numpy. I can work with numpy array instead of tensors, and reshape instead of view, and I don't need a device setting.īased on the class definition above, what I can see here is that I only need the following components from torch to get an output from the forward function: I am aware of this question, but I'm willing to go as low level as possible. Torch.rand(self.num_layers, self.batch_size, self.hidden_size).to(device)) Return (torch.rand(self.num_layers, self.batch_size, self.hidden_size).to(device), #return torch.rand(self.num_layers, self.batch_size, self.hidden_size) Lstm_out, self.hidden = self.lstm(cur_ft_tensor, self.hidden) Output_scores = torch.sigmoid(output_space) #we'll need to check if we need this sigmoidĬur_ft_tensor=feature_list#.view()Ĭur_ft_tensor=cur_ft_tensor.view() Output_space = self.hidden2out(lstm_out.view(len( feature_list), -1)) Lstm_out, _ = self.lstm( feature_list.view(len( feature_list), 1, -1)) Self.hidden2out = nn.Linear(hidden_size, output_size) Self.lstm = nn.LSTM(input_size, hidden_size,num_layers) Self.matching_in_out = matching_in_out #length of input vector matches the length of output vector └── Rough ideas # Initial idea/experiment with Programmable Filterĭef _init_(self, input_size, hidden_size, output_size,num_layers, matching_in_out=False, batch_size=1): └── requirements.txt # package requirements │ └── img-segment # pre-trained models architecture for img segmentation │ ├── img-classify # pre-trained models architecture for img classification │ ├── fluid-segment # pre-trained models architecture for fluid segmentation │ ├── fluid-classify # pre-trained model architecture for fluid classification ├── pre-trained-models # all pre-trained models ├── plugin-test # source code for test plugins (ground truth) │ ├── img_segment_plugin.py # plugin code for image segmentation │ ├── img_classifier_plugin.py # plugin code for image classification │ ├── fluid_segment_plugin.py # plugin code for fluid segmentation │ ├── fluid_classifier_plugin.py # plugin for fluid classification ├── plugin-src # main directory with source code of plugins You have also to control the order of the points.│ ├── datasets # training data So, in your vtk file you have to modify “DIMENSIONS 51200 1 1” and put the proper values of points along the axes. I tried this simple vtk code to show you the idea: (it creates a simple cell) # vtk DataFile Version 2.0 You just have to define the number of points along each direction of the mesh: I think that it would be smarter to create the plane directly in the vtk format instead of creating that in Paraview. Then I took a look to your vtk file and I found that you have: However, I can see in your figure that you didn’t activate “Pass Points Arrays” ? Did you tried that? I tried the method that I told you but it only works in the oposite way, i.e., you can send the data from the plane to your points but not from the points to the plane…sorry for that!.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |