Giter Site home page Giter Site logo

Comments (4)

LaurentMazare avatar LaurentMazare commented on June 10, 2024

The thing is that almost all ops including sum return a tensor that has the same type as the original type. Having the returned tensor type depend on the values in the argument would feel a bit dodgy to me hence this wrapping around behavior. Maybe you could just do the casting on your side via a .eq(1u32)?.to_dtype(DType::U32)?.sum(0)?, this would have the benefit of being more explicit about what actually takes place.

from candle.

michaeleisel avatar michaeleisel commented on June 10, 2024

That solution is adequate for me, we can close this since it sounds like this is intended behavior

from candle.

michaeleisel avatar michaeleisel commented on June 10, 2024

One thing that'd be nice is to detect if overflows occur somehow, and crash if it happens. Perhaps this already occurs on the CPU? Would be nice to at least bring that behavior to the CPU if not, and ideally other devices too, at least for the most basic arithmetic kernels

from candle.

LaurentMazare avatar LaurentMazare commented on June 10, 2024

In rust this typically happens when compiling in debug mode. However when optimizations are enabled, the behavior is overflowing as the overflow check would have some performance impact.

from candle.

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.