From: Nicolas Patry Date: Thu, 6 Apr 2023 08:27:30 +0000 (+0200) Subject: 0-sized tensors allowed. (#226) X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=72594fcce7cf4249ccb62dc5889a63a32dd586cc;p=safetensors.git 0-sized tensors allowed. (#226) --- diff --git a/README.md b/README.md index 6ee27ad..a32c7fa 100644 --- a/README.md +++ b/README.md @@ -78,9 +78,10 @@ Notes: be done for safety concerns - Tensor values are not checked against, in particular NaN and +/-Inf could be in the file - - Empty tensors (tensors with 1 dimension being 0) are not allowed. + - Empty tensors (tensors with 1 dimension being 0) are allowed. They are not storing any data in the databuffer, yet retaining size in the header. - This might be relaxed at a later time if good use cases are found. + They don't really bring a lot of values but are accepted since they are valid tensors + from traditional tensor libraries perspective (torch, tensorflow, numpy, ..). - 0-rank Tensors (tensors with shape `[]`) are allowed, they are merely a scalar. diff --git a/safetensors/README.md b/safetensors/README.md index 6ee27ad..a32c7fa 100644 --- a/safetensors/README.md +++ b/safetensors/README.md @@ -78,9 +78,10 @@ Notes: be done for safety concerns - Tensor values are not checked against, in particular NaN and +/-Inf could be in the file - - Empty tensors (tensors with 1 dimension being 0) are not allowed. + - Empty tensors (tensors with 1 dimension being 0) are allowed. They are not storing any data in the databuffer, yet retaining size in the header. - This might be relaxed at a later time if good use cases are found. + They don't really bring a lot of values but are accepted since they are valid tensors + from traditional tensor libraries perspective (torch, tensorflow, numpy, ..). - 0-rank Tensors (tensors with shape `[]`) are allowed, they are merely a scalar. diff --git a/safetensors/src/lib.rs b/safetensors/src/lib.rs index c9235ff..d80475b 100644 --- a/safetensors/src/lib.rs +++ b/safetensors/src/lib.rs @@ -65,9 +65,10 @@ //! be done for safety concerns //! - Tensor values are not checked against, in particular NaN and +/-Inf could //! be in the file -//! - Empty tensors (tensors with 1 dimension being 0) are not allowed. +//! - Empty tensors (tensors with 1 dimension being 0) are allowed. //! They are not storing any data in the databuffer, yet retaining size in the header. -//! This might be relaxed at a later time if good use cases are found. +//! They don't really bring a lot of values but are accepted since they are valid tensors +//! from traditional tensor libraries perspective (torch, tensorflow, numpy, ..). //! - 0-rank Tensors (tensors with shape `[]`) are allowed, they are merely a scalar. //! //!