Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

numpy collapse last dimension

>>> arr = numpy.zeros((50,100,25))
>>> arr.shape
# (50, 100, 25)

>>> new_arr = arr.reshape(5000,25)
>>> new_arr.shape   
# (5000, 25)

# One shape dimension can be -1. 
# In this case, the value is inferred from 
# the length of the array and remaining dimensions.
>>> another_arr = arr.reshape(-1, arr.shape[-1])
>>> another_arr.shape
# (5000, 25)
Comment

PREVIOUS NEXT
Code Example
Python :: fsting in python 
Python :: how to make turtle shape image smaller 
Python :: dynamic frame latest record 
Python :: set list start at 1 python 
Python :: how to print anything in python 
Python :: python coule nod import the module virtualenvwrapper.hook_loader 
Python :: python3 paramiko read stdout 
Python :: django 2.2 disable cache settings.STATIC_URL 
Python :: pyttsx python not working 
Python :: sumx and ABS in power bi 
Python :: cache in django 
Python :: whta is "upvote":{"$numberInt":""} in python do 
Python :: Single line Commenting in Python 
Python :: python find duplicated zip files 
Python :: Now, we will first look at the simplest way to scan ports with Python 
Python :: what is norways politics 
Python :: if self.quitting: raise BdbQuit in classbased view 
Python :: Feature Importance 
Python :: python type hint superclass 
Python :: subprocess ffmpeg x265 codec 
Python :: how to for loop length print in python 
Python :: types of methods in oop python 
Python :: go to python 
Python :: how list comprehension for 2D works 
Python :: python class udp 
Python :: append to a ldictionary value list 
Python :: class dog_years: years = 0 __ fido=Dog() fido.years=3 print(fido.dog_years()) 
Python :: programação funcional python - append 
Python :: sklearn kmeans mnist 
Python :: flash not defined python flask 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =