From 72594fcce7cf4249ccb62dc5889a63a32dd586cc Mon Sep 17 00:00:00 2001 From: Nicolas Patry Date: Thu, 6 Apr 2023 10:27:30 +0200 Subject: [PATCH] 0-sized tensors allowed. (#226) --- README.md | 5 +++-- safetensors/README.md | 5 +++-- safetensors/src/lib.rs | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) 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. //! //! -- 2.43.0