Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

torch flatten

>>> import torch
>>> t = torch.tensor([[[1, 2],
...                    [3, 4]],
...                   [[5, 6],
...                    [7, 8]]])
>>> torch.flatten(t)
tensor([1, 2, 3, 4, 5, 6, 7, 8])
>>> torch.flatten(t, start_dim=1)
tensor([[1, 2, 3, 4],
        [5, 6, 7, 8]])
Comment

PREVIOUS NEXT
Code Example
Python :: multiple lines input python 
Python :: select pandas by t dtype python 
Python :: python telegram bot 
Python :: how to capture cmd output in python 
Python :: Python from...import statement 
Python :: import picturein colab 
Python :: flatten list python 
Python :: coding planets 
Python :: python list all but first 
Python :: plotting confusion matrix 
Python :: short if python 
Python :: print random integers 
Python :: generate random password django 
Python :: how to allow only for create field in serializer 
Python :: pandas eliminar filas de un dataframe con una condicion 
Python :: log loss python 
Python :: python sum of list axes 
Python :: pandas replace non numeric values with 0? 
Python :: drop first column read_csv 
Python :: python file to array 
Python :: list files in http directory python 
Python :: radiobuttons django 
Python :: change a cell in pandas dataframe 
Python :: create endpoint in python 
Python :: sum of a numpy array 
Python :: how to check all the elements in a list are even or not 
Python :: how to get the parent class using super python 
Python :: add item to python dictionary 
Python :: numpy diff 
Python :: python first three characters of string 
ADD CONTENT
Topic
Content
Source link
Name
3+8 =