score:0
Well, I have two crazy ideas.
One is we can directly use MATLAB’s ‘convn’ in Python. By doing this, open a MATLAB server in Python with ‘eng = matlab.engine.connect_matlab()’.
Now, we can use everything that is belong to MATLAB.
Matrix = eng.convn(Matrix2, ones(x,x,x)/x^3, 'same')
In fact, we can run entire old code in Python with this method, when these codes end with a matrix with small dimensions. We translate it to ‘Numpy’ with
‘numpyArray =np.array(MATLAB_array,dtype=np.XXX)’.
Be carefully. If dimensions of your matrix are large, this translation will be slow.
Another crazy idea is to use ‘tf.nn.conv3d’ in ‘Tensorflow’. The side effect is indirect. We have to build a session to run it with ‘sess = tf.Session()’.
I am not a programmer, but I think that the MATLB is unwilling to be replaced by Python. If you have down a lot of work in MATLAB, it may be hard to translate the code.
Credit To: stackoverflow.com
Related Query
- Matlab's convn in Python
- Python equivalent code to MATLABs vec2mat
- What are the advantages of NumPy over regular Python lists?
- What is the purpose of meshgrid in Python / NumPy?
- Convert NumPy array to Python list
- Converting numpy dtypes to native python types
- How to implement the Softmax function in Python
- Replace all elements of Python NumPy Array that are greater than some value
- np.mean() vs np.average() in Python NumPy?
- How to install python modules without root access?
- Calculating Pearson correlation and significance in Python
- Python memory usage of numpy arrays
- How to calculate rolling / moving average using python + NumPy / SciPy?
- python numpy ValueError: operands could not be broadcast together with shapes
- Index all *except* one item in python
- Python - TypeError: Object of type 'int64' is not JSON serializable
- A tool to convert MATLAB code to Python
- Difference between numpy dot() and Python 3.5+ matrix multiplication @
- What does "three dots" in Python mean when indexing what looks like a number?
- Multiple linear regression in Python
- python numpy machine epsilon
- Automatically import modules when entering the python or ipython interpreter
- python how to pad numpy array with zeros
- Python OpenCV2 (cv2) wrapper to get image size?
- binning data in python with scipy/numpy
- Efficiently checking if arbitrary object is NaN in Python / numpy / pandas?
- How do I calculate r-squared using Python and Numpy?
- Counting the number of non-NaN elements in a numpy ndarray in Python
- Plotting a fast Fourier transform in Python
- Working with TIFFs (import, export) in Python using numpy
More Query from same tag
- Reading CSV with Separator in column values
- Mean values inside matrix
- Replace duplicate value with NaN using groupby
- Python array with fixed length but with sequential filling of new values
- Convert rgb values to one hot labels
- TypeError when Trying to Index into Numpy Array
- Python NumPy Convert FFT To File
- How to label in pandas based on values in other columns? Without duplicating and without rewriting
- Array subtraction and/or reshaping
- OpenMDAO ListGenerator DOEs fail when using multidimensional arrays as inputs
- Cannot install numpy for PyPy 3.8 on Win10
- What is the difference between max(my_array) and my_array.max()
- Finding difference in range of floats in two dictionaries
- Find value indexes in a mother array with a filter array
- NumPy arrays seem very slow; am I doing something wrong?