Comments (4)
Padding with constant in almost every framework use scalar value and its same here (I feel like passing array is some sort of performance optimisation (?) or maybe extra usability cause original code still use only first array element)
You can check original code -> https://github.com/ml-explore/mlx/blob/430bfb494431fbe36c3f635bd7296a356dd772e6/mlx/ops.cpp#L571C1-L577C34
from mlx.
Thanks for pointing me to the original code, I think you're right, I had hopes that the reference to an array was hinting at something more exciting :)
from mlx.
Good question, right now the constant_values
is really just a scalar.
We should probably throw or something if the wrong shape is provided.
I think in Numpy the constant_values
need to be broadcastable to the shape of the pad_width
. So if pad_width
is ((a, b), (c, d))then the
constant_valuesneeds to broadcast to a shape of
[2, 2]`. We can add this as a feature in the future if it's useful.
Also (unrelated) it looks like we should add a linspace
:). If that's pretty useful for you, feel free to file another issue.
from mlx.
Thank you this clarifies. Yes, MLX native linspace
would be handy to have.
from mlx.
Related Issues (20)
- [BUG] Matmul gives wrong output for large sizes HOT 4
- [BUG] broadcast of scalar array in last dimension fails after #1035
- [BUG] Unable to install mlx on MacbookPro M3Pro with MacOS 14.4.1 HOT 1
- [FEATURE] how to return mlx intermediate layer output similarly to Keras HOT 2
- [BUG] cannot replicate a keras model into mlx when I reuse keras pretrained weights
- [BUG] EOS terminator for mlx_lm generate function HOT 1
- [BUG] libc++abi crash when using recurrent layer and transformer HOT 2
- [Feature] arctan2 HOT 3
- [BUG] arithmetic operations with numpy arrays are not commutative HOT 3
- [Feature] KANs HOT 1
- No module named 'mlx.core'; 'mlx' is not a package HOT 2
- 0.12.2 release was not completed HOT 8
- [FEATURE REQUEST] mx.grad doesn't alias argnums and argnames HOT 5
- [BUG] `np.ndarray` of bfloat16 using ml_dtypes is being interpreted as complex64
- [BUG] mlx crashes with msg - uncaught exception of type std::invalid_argument: [Scatter::eval_gpu] Does not support int64 HOT 4
- Is dlpack supported? HOT 9
- [BUG] matmul yields different results when using concat HOT 1
- [BUG] give better diagnostic message when calling compiled code with an eval in it -- currently "Attempting to eval an array without a primitive" HOT 8
- [BUG] Bad result for GPU matmul for specific shape HOT 1
- [Feature] Leak memory on exit HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mlx.