diff --git a/.editorconfig b/.editorconfig
index 02f7749..ab1c17d 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -379,3 +379,13 @@ dotnet_naming_style.s_camelcase.required_prefix = s_
dotnet_naming_style.s_camelcase.required_suffix =
dotnet_naming_style.s_camelcase.word_separator =
dotnet_naming_style.s_camelcase.capitalization = camel_case
+
+
+# Docs
+dotnet_diagnostic.CS1591.severity = suggestion
+
+# cleanup
+
+dotnet_diagnostic.IDE0001.severity = warning
+dotnet_diagnostic.IDE0004.severity = warning
+dotnet_diagnostic.IDE0005.severity = warning
diff --git a/Directory.Build.props b/Directory.Build.props
new file mode 100644
index 0000000..a1a86d4
--- /dev/null
+++ b/Directory.Build.props
@@ -0,0 +1,7 @@
+
+
+ true
+ true
+ true
+
+
diff --git a/Examples/SentimentInference/Example.SentimentInference.Api/Program.cs b/Examples/SentimentInference/Example.SentimentInference.Api/Program.cs
index c951a64..3790d0c 100644
--- a/Examples/SentimentInference/Example.SentimentInference.Api/Program.cs
+++ b/Examples/SentimentInference/Example.SentimentInference.Api/Program.cs
@@ -1,5 +1,4 @@
using Example.SentimentInference.Model;
-using FAI.Core;
using FAI.Core.Abstractions;
using Microsoft.AspNetCore.Mvc;
using Scalar.AspNetCore;
diff --git a/README.md b/README.md
index 291329f..4a85095 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,6 @@
# FAI - Fast AI on A Budget
+[](https://github.com/tjwald/FAI/actions/workflows/publish-nuget.yml)
[](https://github.com/tjwald/FAI/actions/workflows/publish-nuget.yml)
[](https://www.nuget.org/packages/FAI.Core)
[](https://github.com/tjwald/FAI/blob/develop/LICENSE)
diff --git a/global.json b/global.json
new file mode 100644
index 0000000..3140116
--- /dev/null
+++ b/global.json
@@ -0,0 +1,5 @@
+{
+ "test": {
+ "runner": "Microsoft.Testing.Platform"
+ }
+}
diff --git a/src/FAI.Core.Extensions.DI/BuilderExtensions.cs b/src/FAI.Core.Extensions.DI/BuilderExtensions.cs
index 98c3990..bffb753 100644
--- a/src/FAI.Core.Extensions.DI/BuilderExtensions.cs
+++ b/src/FAI.Core.Extensions.DI/BuilderExtensions.cs
@@ -9,7 +9,7 @@ public static IServiceCollection AddConfigurationAndBind(this IS
services.AddOptionsWithValidateOnStart()
.BindConfiguration(section)
.ValidateDataAnnotations();
- services.AddSingleton(sp => sp.GetRequiredService>().Value);
+ services.AddSingleton(sp => sp.GetRequiredService>().Value);
return services;
}
diff --git a/src/FAI.Core.Extensions.DI/FAIBuilderExtensions.cs b/src/FAI.Core.Extensions.DI/FAIBuilderExtensions.cs
index 08d74f7..9c9e0c1 100644
--- a/src/FAI.Core.Extensions.DI/FAIBuilderExtensions.cs
+++ b/src/FAI.Core.Extensions.DI/FAIBuilderExtensions.cs
@@ -13,7 +13,7 @@ public PipelineBuilder AddPipeline()
{
var pipelineBuilder = new PipelineBuilder(services);
- services.AddSingleton>(sp => pipelineBuilder.Build(sp));
+ services.AddSingleton(sp => pipelineBuilder.Build(sp));
return pipelineBuilder;
}
@@ -25,7 +25,7 @@ public PipelineBuilder UsePartitioning(Action(builder.ServiceCollection);
configure(partitionBuilder);
- return builder.Use>(
+ return builder.Use(
(next, sp) => new PartitionPipelineBatchExecutor(partitionBuilder.BuildSchedular(sp), partitionBuilder.BuildSlicer(sp), next));
}
}
diff --git a/src/FAI.Core.Extensions.DI/LocalServiceCollection.cs b/src/FAI.Core.Extensions.DI/LocalServiceCollection.cs
index fc2c855..53c3d07 100644
--- a/src/FAI.Core.Extensions.DI/LocalServiceCollection.cs
+++ b/src/FAI.Core.Extensions.DI/LocalServiceCollection.cs
@@ -94,7 +94,7 @@ private TService ServiceFactory(IServiceProvider sp, object? o) where
if (descriptor.ImplementationType is not null)
{
- return (TService)ActivatorUtilities.CreateInstance(_serviceProvider, descriptor.ImplementationType)!;
+ return (TService)ActivatorUtilities.CreateInstance(_serviceProvider, descriptor.ImplementationType);
}
if (descriptor.ImplementationFactory is not null)
diff --git a/src/FAI.Core.Extensions.DI/PipelineBuilder.cs b/src/FAI.Core.Extensions.DI/PipelineBuilder.cs
index b162b29..2a9037c 100644
--- a/src/FAI.Core.Extensions.DI/PipelineBuilder.cs
+++ b/src/FAI.Core.Extensions.DI/PipelineBuilder.cs
@@ -41,7 +41,7 @@ public PipelineBuilder AddInferenceSteps()
return this;
}
- public PipelineBuilder UsePipeline(Func, IPipeline> factory) where TPipeline : IPipeline
+ public PipelineBuilder UsePipeline(Func, IPipeline> factory)
{
_pipelineFactory = factory;
return this;
@@ -49,10 +49,10 @@ public PipelineBuilder UsePipeline(Func Use() where TBatchExecutor : IPipelineBatchExecutor
{
- return this.Use((next, sp) => ActivatorUtilities.CreateInstance(sp, next));
+ return Use((next, sp) => ActivatorUtilities.CreateInstance(sp, next));
}
- public PipelineBuilder Use(Func, IServiceProvider, IPipelineBatchExecutor> factory) where TBatchExecutor : IPipelineBatchExecutor
+ public PipelineBuilder Use(Func, IServiceProvider, IPipelineBatchExecutor> factory)
{
_batchExecutorFactories.Add(factory);
return this;
diff --git a/src/FAI.Core/InferenceTasks/Classification/ClassificationTensorUtils.cs b/src/FAI.Core/InferenceTasks/Classification/ClassificationTensorUtils.cs
index 0c009d8..effa048 100644
--- a/src/FAI.Core/InferenceTasks/Classification/ClassificationTensorUtils.cs
+++ b/src/FAI.Core/InferenceTasks/Classification/ClassificationTensorUtils.cs
@@ -18,7 +18,7 @@ public static ClassificationResult GetClassificationRes
{
Span probabilities = stackalloc TScore[logits.Length];
TensorPrimitives.SoftMax(logits, probabilities);
- int argmax = TensorPrimitives.IndexOfMax(probabilities);
+ int argmax = TensorPrimitives.IndexOfMax(probabilities);
var score = probabilities[argmax];
TScore[]? logitsArray = classificationOptions.StoreLogits ? logits.ToArray() : null;
diff --git a/src/FAI.NLP.Extensions.DI/BatchExecutorExtensions.cs b/src/FAI.NLP.Extensions.DI/BatchExecutorExtensions.cs
index 9af4f29..e9ac716 100644
--- a/src/FAI.NLP.Extensions.DI/BatchExecutorExtensions.cs
+++ b/src/FAI.NLP.Extensions.DI/BatchExecutorExtensions.cs
@@ -18,7 +18,7 @@ public static class BatchExecutorExtensions
public PipelineBuilder UseTokenSorting(TokenCountSortingBatchExecutorOptions? options = null)
{
options ??= new();
- return builder.Use>((next, sp)
+ return builder.Use((next, sp)
=> ActivatorUtilities.CreateInstance>(sp, next, options));
}
diff --git a/src/FAI.NLP/InferenceTasks/TextMultipleChoice/TextMultipleChoiceTask.cs b/src/FAI.NLP/InferenceTasks/TextMultipleChoice/TextMultipleChoiceTask.cs
index f5ccb69..3186480 100644
--- a/src/FAI.NLP/InferenceTasks/TextMultipleChoice/TextMultipleChoiceTask.cs
+++ b/src/FAI.NLP/InferenceTasks/TextMultipleChoice/TextMultipleChoiceTask.cs
@@ -59,7 +59,7 @@ public override BatchTokenizedResult Preprocess(ReadOnlySpan(CollectionsMarshal.AsSpan(tokens), tokenRow);
+ TensorPrimitives.ConvertChecked(CollectionsMarshal.AsSpan(tokens), tokenRow);
maskRow[..tokens.Count].Fill(1);
outputRow++;
diff --git a/src/FAI.NLP/PipelineBatchExecutors/TokenCountSortingBatchExecutor.cs b/src/FAI.NLP/PipelineBatchExecutors/TokenCountSortingBatchExecutor.cs
index 264c4a5..3a79d07 100644
--- a/src/FAI.NLP/PipelineBatchExecutors/TokenCountSortingBatchExecutor.cs
+++ b/src/FAI.NLP/PipelineBatchExecutors/TokenCountSortingBatchExecutor.cs
@@ -44,8 +44,8 @@ public async Task ExecuteBatchPredict(ReadOnlyMemory inputs, Memory(_options.Ascending);
- MemoryExtensions.Sort>(inputsSorted, inputsSortedIndices, tokenComparer);
+ MemoryExtensions.Sort(inputsSorted, inputsSortedIndices, tokenComparer);
await _executor.ExecuteBatchPredict(inputsSorted, outputSpan);
- MemoryExtensions.Sort(inputsSortedIndices, outputSpan.Span);
+ MemoryExtensions.Sort(inputsSortedIndices, outputSpan.Span);
}
}
diff --git a/src/FAI.NLP/Tokenization/PretrainedTokenizer.cs b/src/FAI.NLP/Tokenization/PretrainedTokenizer.cs
index 93059db..1bf0a0d 100644
--- a/src/FAI.NLP/Tokenization/PretrainedTokenizer.cs
+++ b/src/FAI.NLP/Tokenization/PretrainedTokenizer.cs
@@ -40,7 +40,7 @@ IEnumerator IEnumerable.GetEnumerator()
///
/// Represents a pretrained tokenizer used for tokenizing text inputs and managing token-related transformations.
-/// Wraps a and adds batch functionality.
+/// Wraps a and adds batch functionality.
///
public sealed class PretrainedTokenizer
{
@@ -208,7 +208,7 @@ private static void TokenizeRow(PretrainedTokenizerOptions tokenizerOptions, Lis
Span tokenizationRowSpan = tokenizationSpan[i].AsSpan();
Span maskRowSpan = maskSpan[i].AsSpan();
- TensorPrimitives.ConvertChecked(tokenizedInput, tokenizationRowSpan);
+ TensorPrimitives.ConvertChecked(tokenizedInput, tokenizationRowSpan);
if (tokenizerOptions.PaddingToken != 0) // No need - initialized to 0
{
diff --git a/src/FAI.Onnx/FAI.Onnx.csproj b/src/FAI.Onnx/FAI.Onnx.csproj
index 18717f7..4076af3 100644
--- a/src/FAI.Onnx/FAI.Onnx.csproj
+++ b/src/FAI.Onnx/FAI.Onnx.csproj
@@ -14,7 +14,7 @@
-
+
diff --git a/test/Directory.Build.props b/test/Directory.Build.props
index 5369db9..099f720 100644
--- a/test/Directory.Build.props
+++ b/test/Directory.Build.props
@@ -13,7 +13,7 @@
-
+
diff --git a/test/FAI.Core.Extensions.DI.Tests/PipelineBuilderTests.cs b/test/FAI.Core.Extensions.DI.Tests/PipelineBuilderTests.cs
index f6b7aaf..7432c23 100644
--- a/test/FAI.Core.Extensions.DI.Tests/PipelineBuilderTests.cs
+++ b/test/FAI.Core.Extensions.DI.Tests/PipelineBuilderTests.cs
@@ -1,5 +1,4 @@
using FAI.Core.Abstractions;
-using FAI.Core.PipelineBatchExecutors;
using Microsoft.Extensions.DependencyInjection;
namespace FAI.Core.Extensions.DI.Tests;
@@ -30,8 +29,8 @@ public async Task Build_MaintainsExpectedChainOrder()
_services.AddSingleton(tracker);
var builder = new PipelineBuilder(_services);
- builder.Use((next, sp) => new OrderTrackingExecutor(next, "First", sp.GetRequiredService>()));
- builder.Use((next, sp) => new OrderTrackingExecutor(next, "Second", sp.GetRequiredService>()));
+ builder.Use((next, sp) => new OrderTrackingExecutor(next, "First", sp.GetRequiredService>()));
+ builder.Use((next, sp) => new OrderTrackingExecutor(next, "Second", sp.GetRequiredService>()));
builder.UseSink(sp => new OrderTrackingSink("Sink", sp.GetRequiredService>()));
var sp = _services.BuildServiceProvider();
@@ -75,7 +74,7 @@ public void AddModelExecutor_RegistersFactory()
var mockExecutor = Substitute.For>();
// Act
- builder.AddModelExecutor(_ => mockExecutor);
+ builder.AddModelExecutor(_ => mockExecutor);
// Assert
var sp = _services.BuildServiceProvider();
diff --git a/test/FAI.Core.Tests/BatchSchedularTests/ParallelBatchSchedularTests.cs b/test/FAI.Core.Tests/BatchSchedularTests/ParallelBatchSchedularTests.cs
index 18ddd71..e7393ea 100644
--- a/test/FAI.Core.Tests/BatchSchedularTests/ParallelBatchSchedularTests.cs
+++ b/test/FAI.Core.Tests/BatchSchedularTests/ParallelBatchSchedularTests.cs
@@ -1,7 +1,6 @@
using FAI.Core.Abstractions;
using FAI.Core.BatchSchedulers;
using FAI.Core.Configurations.PipelineBatchExecutors;
-using NSubstitute;
namespace FAI.Core.Tests.BatchSchedularTests;
@@ -35,7 +34,7 @@ public async Task RunInExecutor_RespectsConcurrencyLimit()
int activeTasks = 0;
int maxSeenActiveTasks = 0;
- var lockObj = new System.Threading.Lock();
+ var lockObj = new Lock();
executor.ExecuteBatchPredict(Arg.Any>(), Arg.Any>())
.Returns(async _ =>
diff --git a/test/FAI.Core.Tests/BatchSchedularTests/SerialBatchSchedularTests.cs b/test/FAI.Core.Tests/BatchSchedularTests/SerialBatchSchedularTests.cs
index c3f273e..0d50ec1 100644
--- a/test/FAI.Core.Tests/BatchSchedularTests/SerialBatchSchedularTests.cs
+++ b/test/FAI.Core.Tests/BatchSchedularTests/SerialBatchSchedularTests.cs
@@ -1,6 +1,5 @@
using FAI.Core.Abstractions;
using FAI.Core.BatchSchedulers;
-using NSubstitute;
namespace FAI.Core.Tests.BatchSchedularTests;
diff --git a/test/FAI.Core.Tests/ClassificationTaskTests.cs b/test/FAI.Core.Tests/ClassificationTaskTests.cs
index f4bb8cf..c7ec794 100644
--- a/test/FAI.Core.Tests/ClassificationTaskTests.cs
+++ b/test/FAI.Core.Tests/ClassificationTaskTests.cs
@@ -2,8 +2,6 @@
using FAI.Core.Abstractions;
using FAI.Core.Configurations.InferenceTasks;
using FAI.Core.InferenceTasks.Classification;
-using FAI.Core.ResultTypes;
-using NSubstitute;
namespace FAI.Core.Tests;
@@ -65,7 +63,7 @@ public void GetClassificationResult_ReturnsHighestProbability()
float[] logits = [1.0f, 5.0f, 2.0f];
// Act
- var result = options.GetClassificationResult(logits);
+ var result = options.GetClassificationResult(logits);
// Assert
Assert.Equal("B", result.Choice);
diff --git a/test/FAI.Core.Tests/InferenceStepsTests.cs b/test/FAI.Core.Tests/InferenceStepsTests.cs
index 30b78ad..d634071 100644
--- a/test/FAI.Core.Tests/InferenceStepsTests.cs
+++ b/test/FAI.Core.Tests/InferenceStepsTests.cs
@@ -1,5 +1,4 @@
using FAI.Core.Abstractions;
-using NSubstitute;
namespace FAI.Core.Tests;
@@ -11,7 +10,7 @@ private class TestInferenceSteps : InferenceSteps
public override Task RunModel(ReadOnlyMemory input, int preprocesses)
{
- return Task.FromResult((double)preprocesses * 2.0);
+ return Task.FromResult(preprocesses * 2.0);
}
public override void PostProcess(ReadOnlySpan inputs, int preprocesses, double modelOutput, Span outputs)
diff --git a/test/FAI.Core.Tests/PipelineBatchExecutorTests/BackgroundPipelineBatchExecutorTests.cs b/test/FAI.Core.Tests/PipelineBatchExecutorTests/BackgroundPipelineBatchExecutorTests.cs
index ad92697..033571d 100644
--- a/test/FAI.Core.Tests/PipelineBatchExecutorTests/BackgroundPipelineBatchExecutorTests.cs
+++ b/test/FAI.Core.Tests/PipelineBatchExecutorTests/BackgroundPipelineBatchExecutorTests.cs
@@ -1,6 +1,5 @@
using FAI.Core.Abstractions;
using FAI.Core.PipelineBatchExecutors;
-using NSubstitute;
namespace FAI.Core.Tests.PipelineBatchExecutorTests;
diff --git a/test/FAI.Core.Tests/PipelineBatchExecutorTests/PartitionPipelineBatchExecutorTests.cs b/test/FAI.Core.Tests/PipelineBatchExecutorTests/PartitionPipelineBatchExecutorTests.cs
index 9180478..01f778d 100644
--- a/test/FAI.Core.Tests/PipelineBatchExecutorTests/PartitionPipelineBatchExecutorTests.cs
+++ b/test/FAI.Core.Tests/PipelineBatchExecutorTests/PartitionPipelineBatchExecutorTests.cs
@@ -1,6 +1,5 @@
using FAI.Core.Abstractions;
using FAI.Core.PipelineBatchExecutors;
-using NSubstitute;
namespace FAI.Core.Tests.PipelineBatchExecutorTests;
diff --git a/test/FAI.Core.Tests/PipelineBatchExecutorTests/PipelineLinkBatchExecutorTests.cs b/test/FAI.Core.Tests/PipelineBatchExecutorTests/PipelineLinkBatchExecutorTests.cs
index de82e4b..a6121f3 100644
--- a/test/FAI.Core.Tests/PipelineBatchExecutorTests/PipelineLinkBatchExecutorTests.cs
+++ b/test/FAI.Core.Tests/PipelineBatchExecutorTests/PipelineLinkBatchExecutorTests.cs
@@ -1,7 +1,6 @@
using System.Buffers;
using FAI.Core.Abstractions;
using FAI.Core.PipelineBatchExecutors;
-using NSubstitute;
namespace FAI.Core.Tests.PipelineBatchExecutorTests;
diff --git a/test/FAI.Core.Tests/PipelineBatchExecutorTests/RoutingPipelineBatchExecutorTests.cs b/test/FAI.Core.Tests/PipelineBatchExecutorTests/RoutingPipelineBatchExecutorTests.cs
index ed377bb..29756f9 100644
--- a/test/FAI.Core.Tests/PipelineBatchExecutorTests/RoutingPipelineBatchExecutorTests.cs
+++ b/test/FAI.Core.Tests/PipelineBatchExecutorTests/RoutingPipelineBatchExecutorTests.cs
@@ -1,6 +1,5 @@
using FAI.Core.Abstractions;
using FAI.Core.PipelineBatchExecutors;
-using NSubstitute;
namespace FAI.Core.Tests.PipelineBatchExecutorTests;
diff --git a/test/FAI.Core.Tests/PipelineBatchExecutorTests/SinkPipelineBatchExecutorTests.cs b/test/FAI.Core.Tests/PipelineBatchExecutorTests/SinkPipelineBatchExecutorTests.cs
index 48d9c05..b2858c8 100644
--- a/test/FAI.Core.Tests/PipelineBatchExecutorTests/SinkPipelineBatchExecutorTests.cs
+++ b/test/FAI.Core.Tests/PipelineBatchExecutorTests/SinkPipelineBatchExecutorTests.cs
@@ -1,6 +1,5 @@
using FAI.Core.Abstractions;
using FAI.Core.PipelineBatchExecutors;
-using NSubstitute;
namespace FAI.Core.Tests.PipelineBatchExecutorTests;
diff --git a/test/FAI.Core.Tests/PipelineBatchExecutorTests/StreamedBatchExecutorTests.cs b/test/FAI.Core.Tests/PipelineBatchExecutorTests/StreamedBatchExecutorTests.cs
index ddd0b82..1837ad0 100644
--- a/test/FAI.Core.Tests/PipelineBatchExecutorTests/StreamedBatchExecutorTests.cs
+++ b/test/FAI.Core.Tests/PipelineBatchExecutorTests/StreamedBatchExecutorTests.cs
@@ -1,7 +1,6 @@
using FAI.Core.Abstractions;
using FAI.Core.PipelineBatchExecutors;
using Microsoft.Extensions.Logging.Abstractions;
-using NSubstitute;
namespace FAI.Core.Tests.PipelineBatchExecutorTests;
diff --git a/test/FAI.Core.Tests/PipelineTests/AccumulatingPipelineTests.cs b/test/FAI.Core.Tests/PipelineTests/AccumulatingPipelineTests.cs
index bb76974..a844069 100644
--- a/test/FAI.Core.Tests/PipelineTests/AccumulatingPipelineTests.cs
+++ b/test/FAI.Core.Tests/PipelineTests/AccumulatingPipelineTests.cs
@@ -1,7 +1,6 @@
using FAI.Core.Abstractions;
using FAI.Core.Pipelines;
using Microsoft.Extensions.Logging.Abstractions;
-using NSubstitute;
namespace FAI.Core.Tests.PipelineTests;
diff --git a/test/FAI.Core.Tests/TensorExtensionsTests.cs b/test/FAI.Core.Tests/TensorExtensionsTests.cs
index 08d9ce3..ad3cef7 100644
--- a/test/FAI.Core.Tests/TensorExtensionsTests.cs
+++ b/test/FAI.Core.Tests/TensorExtensionsTests.cs
@@ -1,5 +1,4 @@
using System.Numerics.Tensors;
-using FAI.Core;
namespace FAI.Core.Tests;
@@ -48,7 +47,7 @@ public void AsMemory_Tensor_ReturnsCorrectMemory()
{
// Arrange
float[] data = [1.0f, 2.0f, 3.0f];
- var tensor = Tensor.Create(data, [3]);
+ var tensor = Tensor.Create(data, [3]);
// Act
var memory = tensor.AsMemory();
diff --git a/test/FAI.Extensions.Evaluation.Tests/EvaluationPipelineTests.cs b/test/FAI.Extensions.Evaluation.Tests/EvaluationPipelineTests.cs
index 2ab09c3..18e01c7 100644
--- a/test/FAI.Extensions.Evaluation.Tests/EvaluationPipelineTests.cs
+++ b/test/FAI.Extensions.Evaluation.Tests/EvaluationPipelineTests.cs
@@ -1,6 +1,5 @@
using FAI.Core.Abstractions;
using Microsoft.Extensions.Logging.Abstractions;
-using NSubstitute;
namespace FAI.Extensions.Evaluation.Tests;
diff --git a/test/FAI.IntegrationTests/GlobalUsings.cs b/test/FAI.IntegrationTests/GlobalUsings.cs
index 4b536fc..434042f 100644
--- a/test/FAI.IntegrationTests/GlobalUsings.cs
+++ b/test/FAI.IntegrationTests/GlobalUsings.cs
@@ -1,20 +1,16 @@
global using System.Numerics.Tensors;
-global using System.Runtime.CompilerServices;
global using FAI.Core.Abstractions;
global using FAI.Core.BatchSchedulers;
global using FAI.Core.Configurations.InferenceTasks;
global using FAI.Core.Configurations.PipelineBatchExecutors;
global using FAI.Core.Extensions.DI;
global using FAI.Core.PipelineBatchExecutors;
-global using FAI.Core.Pipelines;
global using FAI.Core.ResultTypes;
global using FAI.NLP.Configuration;
global using FAI.NLP.InferenceTasks.TextClassification;
global using FAI.NLP.InferenceTasks.TextMultipleChoice;
global using FAI.NLP.Tests.Mocks;
global using FAI.NLP.Tokenization;
-global using FAI.Onnx.ModelExecutors;
-global using FAI.Onnx.Tests.Utils;
global using FluentAssertions;
global using Microsoft.Extensions.DependencyInjection;
global using Xunit;
diff --git a/test/FAI.IntegrationTests/LogicalMockModelExecutor.cs b/test/FAI.IntegrationTests/LogicalMockModelExecutor.cs
index bb7d9e8..bbcf550 100644
--- a/test/FAI.IntegrationTests/LogicalMockModelExecutor.cs
+++ b/test/FAI.IntegrationTests/LogicalMockModelExecutor.cs
@@ -13,7 +13,7 @@ public LogicalMockModelExecutor(float[][] outputs)
public Task[]> RunAsync(Tensor[] inputs)
{
var data = _outputs[_callCount % _outputs.Length];
- var output = Tensor.Create(data, [(nint)data.Length]);
+ var output = Tensor.Create(data, [data.Length]);
_callCount++;
return Task.FromResult(new[] { output });
}
@@ -31,7 +31,7 @@ public Task RunAsync(Tensor[] inputs, Action, in
row.AsSpan().CopyTo(batchOutput.AsSpan(i * outputSize));
}
- var batchTensor = Tensor.Create(batchOutput, [(nint)batchSize, (nint)outputSize]);
+ var batchTensor = Tensor.Create(batchOutput, [batchSize, outputSize]);
postProcess(batchTensor, 0); // Assuming model has 1 output tensor
return Task.CompletedTask;
diff --git a/test/FAI.IntegrationTests/MultipleChoiceIntegrationTests.cs b/test/FAI.IntegrationTests/MultipleChoiceIntegrationTests.cs
index 4f4b024..3dd6ad4 100644
--- a/test/FAI.IntegrationTests/MultipleChoiceIntegrationTests.cs
+++ b/test/FAI.IntegrationTests/MultipleChoiceIntegrationTests.cs
@@ -14,7 +14,7 @@ public async Task FullPipeline_ShouldHandleMultipleChoice()
.Use>>();
var tokenizer = DummyTokenizerFactory.Create();
- services.AddSingleton(tokenizer);
+ services.AddSingleton(tokenizer);
services.AddSingleton(new TextMultipleChoiceOptions { MaxChoices = 2 });
// Mock model: always returns [0.9, 0.1] logits
diff --git a/test/FAI.IntegrationTests/PipelineConfigurationIntegrationTests.cs b/test/FAI.IntegrationTests/PipelineConfigurationIntegrationTests.cs
index eeee8fa..18feda2 100644
--- a/test/FAI.IntegrationTests/PipelineConfigurationIntegrationTests.cs
+++ b/test/FAI.IntegrationTests/PipelineConfigurationIntegrationTests.cs
@@ -18,7 +18,7 @@ public async Task ComplexPipeline_WithBackgroundAndPartitioning_ShouldProcessBat
// Setup dependencies
var tokenizer = DummyTokenizerFactory.Create();
- services.AddSingleton(tokenizer);
+ services.AddSingleton(tokenizer);
services.AddSingleton>, ParallelBatchSchedular>>();
services.AddSingleton, FixedSizeBatchSlicer>();
diff --git a/test/FAI.IntegrationTests/TextClassificationIntegrationTests.cs b/test/FAI.IntegrationTests/TextClassificationIntegrationTests.cs
index 2449b01..21ddf84 100644
--- a/test/FAI.IntegrationTests/TextClassificationIntegrationTests.cs
+++ b/test/FAI.IntegrationTests/TextClassificationIntegrationTests.cs
@@ -17,7 +17,7 @@ public async Task FullPipeline_ShouldClassifyText()
.Use>>();
var tokenizer = DummyTokenizerFactory.Create();
- services.AddSingleton(tokenizer);
+ services.AddSingleton(tokenizer);
// Mock model: always returns high probability for 'true' (index 1)
services.AddSingleton>(new LogicalMockModelExecutor([[0.1f, 0.9f]]));
diff --git a/test/FAI.NLP.Extensions.DI.Tests/BatchExecutorExtensionsTests.cs b/test/FAI.NLP.Extensions.DI.Tests/BatchExecutorExtensionsTests.cs
index b9f04b2..5bb3991 100644
--- a/test/FAI.NLP.Extensions.DI.Tests/BatchExecutorExtensionsTests.cs
+++ b/test/FAI.NLP.Extensions.DI.Tests/BatchExecutorExtensionsTests.cs
@@ -6,8 +6,6 @@
using FAI.NLP.BatchSlicer;
using FAI.NLP.Configuration;
using FAI.NLP.Configuration.PipelineBatchExecutors;
-using FAI.NLP.Extensions.DI;
-using FAI.NLP.PipelineBatchExecutors;
using FAI.NLP.Tokenization;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
diff --git a/test/FAI.Onnx.Tests/FAI.Onnx.Tests.csproj b/test/FAI.Onnx.Tests/FAI.Onnx.Tests.csproj
index bec6110..98cfb55 100644
--- a/test/FAI.Onnx.Tests/FAI.Onnx.Tests.csproj
+++ b/test/FAI.Onnx.Tests/FAI.Onnx.Tests.csproj
@@ -5,7 +5,7 @@
-
+
diff --git a/test/FAI.Onnx.Tests/ModelExecutors/AsyncOnnxModelExecutorTests.cs b/test/FAI.Onnx.Tests/ModelExecutors/AsyncOnnxModelExecutorTests.cs
index 29cabae..060d1e7 100644
--- a/test/FAI.Onnx.Tests/ModelExecutors/AsyncOnnxModelExecutorTests.cs
+++ b/test/FAI.Onnx.Tests/ModelExecutors/AsyncOnnxModelExecutorTests.cs
@@ -1,7 +1,6 @@
using System.Numerics.Tensors;
using FAI.Onnx.Configuration;
using FAI.Onnx.ModelExecutors;
-using Microsoft.ML.OnnxRuntime;
namespace FAI.Onnx.Tests.ModelExecutors;
@@ -31,8 +30,8 @@ public async Task RunAsync_ShouldExecuteRealInference()
Assert.Single(results);
var output = results[0];
Assert.Equal(2, output.Lengths.Length);
- Assert.Equal(1L, (long)output.Lengths[0]);
- Assert.Equal(3L, (long)output.Lengths[1]);
+ Assert.Equal(1L, output.Lengths[0]);
+ Assert.Equal(3L, output.Lengths[1]);
// The minimal model casts long to float
Assert.Equal(10.0f, output[0, 0]);
@@ -60,7 +59,7 @@ public async Task RunAsync_WithPostProcess_ShouldExecuteRealInference()
await executor.RunAsync(inputs, (span, index) =>
{
called = true;
- outputShape = [(long)span.Lengths[0], (long)span.Lengths[1]];
+ outputShape = [(span.Lengths[0]), (span.Lengths[1])];
Assert.Equal(100.0f, span[0, 0]);
Assert.Equal(200.0f, span[0, 1]);
Assert.Equal(300.0f, span[0, 2]);
diff --git a/test/FAI.Onnx.Tests/Utils/CircularAtomicCounterTests.cs b/test/FAI.Onnx.Tests/Utils/CircularAtomicCounterTests.cs
index d7ea210..0fb864d 100644
--- a/test/FAI.Onnx.Tests/Utils/CircularAtomicCounterTests.cs
+++ b/test/FAI.Onnx.Tests/Utils/CircularAtomicCounterTests.cs
@@ -33,7 +33,7 @@ public void Next_ShouldBeThreadSafe()
const int threadCount = 10;
var counter = new CircularAtomicCounter(maxValue);
var results = new int[maxValue];
- var @lock = new System.Threading.Lock();
+ var @lock = new Lock();
// Act
Parallel.For(0, threadCount, _ =>
diff --git a/test/FAI.Onnx.Tests/Utils/OnnxTensorUtilsTests.cs b/test/FAI.Onnx.Tests/Utils/OnnxTensorUtilsTests.cs
index 273455f..6b019a9 100644
--- a/test/FAI.Onnx.Tests/Utils/OnnxTensorUtilsTests.cs
+++ b/test/FAI.Onnx.Tests/Utils/OnnxTensorUtilsTests.cs
@@ -1,5 +1,4 @@
using FAI.Onnx.Utils;
-using Microsoft.ML.OnnxRuntime;
namespace FAI.Onnx.Tests.Utils;
diff --git a/test/FAI.Onnx.Tests/Utils/OnnxTestModelFactory.cs b/test/FAI.Onnx.Tests/Utils/OnnxTestModelFactory.cs
index 7b4e220..5c47b42 100644
--- a/test/FAI.Onnx.Tests/Utils/OnnxTestModelFactory.cs
+++ b/test/FAI.Onnx.Tests/Utils/OnnxTestModelFactory.cs
@@ -1,6 +1,3 @@
-using System.Numerics.Tensors;
-using FAI.Onnx.Configuration;
-using FAI.Onnx.ModelExecutors;
using Microsoft.ML.OnnxRuntime;
namespace FAI.Onnx.Tests.Utils;