Skip to content

Support 4D arrays #217

@Monnoroch

Description

@Monnoroch

The documentation says this library only supports kernels working with 1,2,3D arrays. How hard it would be to support 4D arrays?

Activity

robertleeplummerjr

robertleeplummerjr commented on Nov 18, 2017

@robertleeplummerjr
Member

Currently, it'd be hard. But long term, it may be a good move. Are you talking hypothetically, or do you have a use case where you have 4d+ arrays?

harish2704

harish2704 commented on Jan 14, 2018

@harish2704
  • gpu.js will be very much helpful if we want to run evaluation of any pre-trained neural network models in client side.
  • In the case of Neural netowk/Machine learning, most of common use case of 4D array is 2DConvolution.
    • 2DConvoulution will transform one 2D image ( or 2D array ) into array of 2D images ( 3D array ).
  • Applying 2D convolution on array of 2DImages (3DArray ) will result a 4D array which is an example use of 4D array.

-just an info

robertleeplummerjr

robertleeplummerjr commented on Jan 14, 2018

@robertleeplummerjr
Member
  • gpu.js will be very much helpful if we want to run evaluation of any pre-trained neural network models in client side.

Agreed! But we want to as well ensure that gpu.js can be used to train neural networks, and that vision will be achieved more in version 2 when OpenCL is added (node) and WebGL 2 is supported (client and node), however training does work as of now in both environments.

  • In the case of Neural netowk/Machine learning, most of common use case of 4D array is 2DConvolution.
    • 2DConvoulution will transform one 2D image ( or 2D array ) into array of 2D images ( 3D array ).
  • Applying 2D convolution on array of 2DImages (3DArray ) will result a 4D array which is an example use of 4D array.

Here (brain.js) is an example of a convolution that runs on gpu.js. While there are several layers of of looping, the result is still three dimensional: https://github.com/BrainJS/brain.js/blob/ff66428f828c528c1cf61379c761c1eb7f50c471/src/layer/convolution.js#L61

Does that help at all?

harish2704

harish2704 commented on Jan 14, 2018

@harish2704

Thanks. brain.js was very useful link.

Regarding Opencl: Opencl backend will be super cool feature .. I will be waiting for it..

added this to the v3.0.0 milestone on May 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @robertleeplummerjr@Monnoroch@harish2704

        Issue actions

          Support 4D arrays · Issue #217 · gpujs/gpu.js