Merge pull request #310 from martindevans/better_tensor_splits_specification

Better TensorSplitsCollection Initialisation
This commit is contained in:
Martin Evans 2023-11-18 17:30:09 +00:00 committed by GitHub
commit d11702c4ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -134,9 +134,10 @@ namespace LLama.Abstractions
/// <exception cref="ArgumentException"></exception>
public TensorSplitsCollection(float[] splits)
{
if (splits.Length != Splits.Length)
throw new ArgumentException($"tensor splits length must equal {Splits.Length}");
Splits = splits;
if (splits.Length > Splits.Length)
throw new ArgumentException($"Must supply at most {Splits.Length} tensor splits", nameof(splits));
splits.CopyTo(Splits.AsSpan());
}
/// <summary>