Coder Social home page Coder Social logo

Comments (5)

soraros avatar soraros commented on July 29, 2024

@laszlokindrat Another problem related to #2860.

In this function, Mojo is trying construct a SIMD[DType.uint64, n] from a Boolable value self.mem.

    fn test[n: Int](self) -> SIMD[DType.uint64, n]:
        return self.mem

You should write it as

    fn test[n: Int](self) -> SIMD[DType.uint64, n]:
        return rebind[SIMD[DType.uint64, n]](self.mem)

That said, if n != m, it won't compile anyway.

from mojo.

lbartworks avatar lbartworks commented on July 29, 2024

I think this shows as well the same issue:

def main():

    var mask=SIMD[DType.bool,8](True, False, False, True, True, True, True, True)
    var mask2=SIMD[DType.bool,8](False, False, False, True, True, True, True, True)

    #works
    print (mask.__and__( mask2))
    
    #does not work
    #print (mask and mask2)

from mojo.

soraros avatar soraros commented on July 29, 2024

It's intentional that m1 and m2 won't work if their size are larger than 1. Should have written

print(all(mask) and all(mask2))

from mojo.

lbartworks avatar lbartworks commented on July 29, 2024

No if you want a vectorized AND. In fact, this works vectorized (ie size > 1):

print (mask.and( mask2))

from mojo.

soraros avatar soraros commented on July 29, 2024

Exactly, the vectorized and is a different thing from and, the operator form is mask & mask2. and doesn't work by design.

from mojo.

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.