Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

pytorch unsqueeze

ft = torch.Tensor([0, 1, 2])
print(ft.shape)
>>> torch.Size([3])

print(ft.unsqueeze(0)) # 0 means first dimension
print(ft.unsqueeze(0).shape)
>>> tensor([[0., 1., 2.]])
>>> torch.Size([1, 3])
Comment

PREVIOUS NEXT
Code Example
Python :: filter pandas stack overflow 
Python :: how to make an app like word in python 
Python :: QuizListView login required django 
Python :: create animation from sequence of image python 
Python :: socket python how to check if server alive 
Python :: Exception Type with except block: 
Python :: Block encoding request python 
Python :: what is python virtual environment 
Python :: datetime german format python 
Python :: print hello in python 
Python :: how to loadh5 file in python 
Python :: sorted key len python 
Python :: Python Record live streams (TS FILES) 
Python :: pandas df where 
Python :: .all() python numpy 
Python :: how to make an application using python 
Python :: empty python file 
Python :: extract list from string python 
Python :: inline keyboard telegram bot python 
Python :: python function to multiply two numbers 
Python :: do while in python 
Python :: how to plot using pyplot 
Python :: how to mention someone discord.py 
Python :: python list remove all elements 
Python :: python check for exception 
Python :: hide console in python build 
Python :: slider python 
Python :: how to find last element in array python 
Python :: pine script to python 
Python :: tkinter bg button 
ADD CONTENT
Topic
Content
Source link
Name
7+1 =