Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

torch.tensor.expand

>>> x = torch.tensor([[1], [2], [3]])
>>> x.size()
torch.Size([3, 1])
>>> x.expand(3, 4)
tensor([[ 1,  1,  1,  1],
        [ 2,  2,  2,  2],
        [ 3,  3,  3,  3]])
>>> x.expand(-1, 4)   # -1 means not changing the size of that dimension
tensor([[ 1,  1,  1,  1],
        [ 2,  2,  2,  2],
        [ 3,  3,  3,  3]])
Comment

PREVIOUS NEXT
Code Example
Python :: python cv2 blob detection seg fault 
Python :: sns countplot show only largest 
Python :: Freqtrade - sell after x candels 
Python :: Streaming upload requests python 
Python :: how to add sum of range in python 
Python :: most efficient fibonacci number algorithm 
Python :: assert raises with properties python 
Python :: Find & set values in pandas Dataframe 
Python :: Get the count of each categorical value (0 and 1) in labels 
Python :: how do i select a range of columns by index 
Python :: python boolean ungleich 
Python :: importing modules 
Python :: pd df pivot 
Python :: python text to speech arabic 
Python :: print next line 
Python :: python object has no attribute 
Python :: pandas groupby and keep columns 
Python :: join paths in python 
Python :: get member by id discord py 
Python :: break 
Python :: pyinstaller windows 
Python :: Python communication with serial port 
Python :: rename folder python 
Python :: how to create multiple variables in a loop python 
Python :: math floor python 
Python :: export an excel table to image with python 
Python :: positive and negative number in python 
Python :: upload image to s3 python 
Python :: tri python 
Python :: pytest-mock tutorial 
ADD CONTENT
Topic
Content
Source link
Name
3+7 =