null
null
MModular
Created by null on 7/10/2024 in #questions
How to initialize a tensor[DType.int8] with random values of either: -1, 0, or 1?
Probably a dumb question, but how can I initialize a Tensor like so with random values of either -1, 0, or 1?
var a = Tensor[DType.int8](size)
var a = Tensor[DType.int8](size)
The rand functions I could find either don't let me specify the range, or work for other data types. Furthermore, is this really only for SIMD compatible sizes? Like what if I wanted it to have 10,000 elements? Is Tensor the wrong data type for this? I want to perform element-wise vector operations on it later, like xor(vector_a, vector_b) - but in a highly parallel way
16 replies