Git Product home page Git Product logo

Comments (2)

robertmccraith avatar robertmccraith commented on July 28, 2024 5

I have implemented some CNN layers here: https://github.com/robertmccraith/mimm
More models to be implemented over time, feel free to contribute

from mlx.

angeloskath avatar angeloskath commented on July 28, 2024 4

Don't know if it is going to be the next release but we probably will implement fast pooling and/or upsampling operations.

In the meantime you can do some of those using array operations like the upsampling 2d in the stable diffusion example:

def upsample_nearest(x, scale: int = 2):
    B, H, W, C = x.shape
    x = mx.broadcast_to(x[:, :, None, :, None, :], (B, H, scale, W, scale, C))
    x = x.reshape(B, H * scale, W * scale, C)

    return x

or use strided conv or reshapes to do pooling operations (haven't tested the code below but it should work):

def avg_pool_2d(x, stride: int = 2):
    B, W, H, C = x.shape
    x = x.reshape(B, W//stride, stride, H//stride, stride, C).mean((2, 4))
    return x

from mlx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.