]> khamidou — GitHub mirrors - safetensors.git/commitdiff
0-sized tensors allowed. (#226)
authorNicolas Patry <patry.nicolas@protonmail.com>
Thu, 6 Apr 2023 08:27:30 +0000 (10:27 +0200)
committerGitHub <noreply@github.com>
Thu, 6 Apr 2023 08:27:30 +0000 (10:27 +0200)
README.md
safetensors/README.md
safetensors/src/lib.rs

index 6ee27adf3543dc42f7135e0f2ba8cb2a05c23884..a32c7fa322479ab2143626a66ddb37f90c715af1 100644 (file)
--- 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.
 
 
index 6ee27adf3543dc42f7135e0f2ba8cb2a05c23884..a32c7fa322479ab2143626a66ddb37f90c715af1 100644 (file)
@@ -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.
 
 
index c9235ff67e1b378c8585292bf2f5c18901771f81..d80475bda814e2c0c5488b88f760eebfe299d041 100644 (file)
 //!  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.
 //!
 //!