Closed rohany closed 2 years ago
Is it possible to read a tensor from disk and then set all nonzero entries of that tensor to a particular value? I don't see anything like this in the API, so double checking here.
You can use Transform // add 1 to all nonzeros in v Transform<float>([](float & a){ a+=1; })(v["i"]); Look at codes in ./examples
Transform
// add 1 to all nonzeros in v
Transform<float>([](float & a){ a+=1; })(v["i"]);
./examples
Thanks, this worked!
Is it possible to read a tensor from disk and then set all nonzero entries of that tensor to a particular value? I don't see anything like this in the API, so double checking here.