Skip to content

Commit 8a67e77

Browse files
claudiamurialdoBeta Bot
authored andcommitted
Cherry pick branch 'genexuslabs:fix/embedding-empty' into beta
1 parent 08e60e7 commit 8a67e77

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

dotnet/src/dotnetcore/GxClasses/Domain/GxEmbedding.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,16 @@ internal GxEmbedding(float[] embedding)
2828
}
2929
public bool IsEmpty()
3030
{
31-
return _embedding.IsEmpty;
31+
ReadOnlySpan<float> span = _embedding.Span;
32+
if (span != null)
33+
{
34+
for (int i = 0; i < span.Length; i++)
35+
{
36+
if (span[i] != 0f)
37+
return false;
38+
}
39+
}
40+
return true;
3241
}
3342
internal static GxEmbedding Empty(string model, int dimensions)
3443
{

0 commit comments

Comments
 (0)