Giter Site home page Giter Site logo

Random numbers and dtypes about autoray HOT 1 CLOSED

jcmgray avatar jcmgray commented on May 29, 2024
Random numbers and dtypes

from autoray.

Comments (1)

jcmgray avatar jcmgray commented on May 29, 2024

Yeah this is a slightly fiddly one, my approach so far is just to focus on what happens once you have created the arrays, with the random functions included so far mostly just for testing purposes. Jax already handles random numbers pretty differently.

Having said that having a guaranteed interface for being able to call (as a first draft of things I too would find useful):

  • random.normal / random.uniform
  • eye / identity
  • zeros
  • ones

with dtype specified would be useful in and of itself, as well as for writing lots of algorithms which aren't 'creating arrays' as their overall purpose - e.g. randomized SVD etc.

Happy to accept any PRs along this direction. Some general thoughts:

  • I think supporting the more concise do('random.normal', ...) style calls would be simplest to begin with, even if numpy.random.Generator is used in the background.
  • Unless they are exceptionally easy to add I'm tempted to leave out stuff like binomial until someones needs them.
  • I think it would make sense to default to dtype=None with the backend deciding the dtype since jax e.g. and other backends have goodish reasons for by default forcing everything to the same precision (hardware-acceleration) - in other words, dtype control probably should be opt-in with errors / loud warnings? when it can't be provided

from autoray.

Related Issues (8)

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.