{"author":"Skosh","author_email":"rasmus.gustafsson2611@gmail.com","author_time":1710110880,"commit_time":1710110880,"committer":"GitHub","committer_email":"noreply@github.com","hash":"e8c350fdac330d21d0eea5d6ee66ddf87805dfeb","message":"fix: make Tensor.rand produce correct values for float16 (#3654)\n\n* fix: make Tensor.rand produce correct values for float16\r\n\r\nDue to precision loss when casting to float16, the data distribution created by custom_random isnt correctly in the interval ]0, 1[, but instead in the interval ]0, 1], which causes the Tensor.randn to incorrectly generate values of infinity.\r\n\r\nThe solution uses a scaling value to make sure the values stay under 1, when using half precision.\r\n\r\nCloses #3611\r\n\r\n* update implementation to truncate to closest f16 value to 1\r\n\r\n* chore: fix whitespace\r\n\r\n* test larger distribution\r\n\r\n---------\r\n\r\nCo-authored-by: chenyu <chenyu@fastmail.com>","parents":["bad6adaf8c2be7fd36089909b6cf83e002787623"],"tree_hash":"d53d18e7efe092b4b8f30fb8b279f33fd7c13d65"}