You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

llama.native.llamakvcacheviewsafehandle.md 2.5 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. # LLamaKvCacheViewSafeHandle
  2. Namespace: LLama.Native
  3. A safe handle for a LLamaKvCacheView
  4. ```csharp
  5. public class LLamaKvCacheViewSafeHandle : SafeLLamaHandleBase, System.IDisposable
  6. ```
  7. Inheritance [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object) → [CriticalFinalizerObject](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.constrainedexecution.criticalfinalizerobject) → [SafeHandle](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.safehandle) → [SafeLLamaHandleBase](./llama.native.safellamahandlebase.md) → [LLamaKvCacheViewSafeHandle](./llama.native.llamakvcacheviewsafehandle.md)<br>
  8. Implements [IDisposable](https://docs.microsoft.com/en-us/dotnet/api/system.idisposable)
  9. ## Properties
  10. ### **IsInvalid**
  11. ```csharp
  12. public bool IsInvalid { get; }
  13. ```
  14. #### Property Value
  15. [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)<br>
  16. ### **IsClosed**
  17. ```csharp
  18. public bool IsClosed { get; }
  19. ```
  20. #### Property Value
  21. [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)<br>
  22. ## Constructors
  23. ### **LLamaKvCacheViewSafeHandle(SafeLLamaContextHandle, LLamaKvCacheView)**
  24. Initialize a LLamaKvCacheViewSafeHandle which will call `llama_kv_cache_view_free` when disposed
  25. ```csharp
  26. public LLamaKvCacheViewSafeHandle(SafeLLamaContextHandle ctx, LLamaKvCacheView view)
  27. ```
  28. #### Parameters
  29. `ctx` [SafeLLamaContextHandle](./llama.native.safellamacontexthandle.md)<br>
  30. `view` [LLamaKvCacheView](./llama.native.llamakvcacheview.md)<br>
  31. ## Methods
  32. ### **Allocate(SafeLLamaContextHandle, Int32)**
  33. Allocate a new KV cache view which can be used to inspect the KV cache
  34. ```csharp
  35. public static LLamaKvCacheViewSafeHandle Allocate(SafeLLamaContextHandle ctx, int maxSequences)
  36. ```
  37. #### Parameters
  38. `ctx` [SafeLLamaContextHandle](./llama.native.safellamacontexthandle.md)<br>
  39. `maxSequences` [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
  40. The maximum number of sequences visible in this view per cell
  41. #### Returns
  42. [LLamaKvCacheViewSafeHandle](./llama.native.llamakvcacheviewsafehandle.md)<br>
  43. ### **ReleaseHandle()**
  44. ```csharp
  45. protected bool ReleaseHandle()
  46. ```
  47. #### Returns
  48. [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)<br>
  49. ### **Update()**
  50. Update this view
  51. ```csharp
  52. public void Update()
  53. ```
  54. ### **GetView()**
  55. Get the raw KV cache view
  56. ```csharp
  57. public LLamaKvCacheView& GetView()
  58. ```
  59. #### Returns
  60. [LLamaKvCacheView&](./llama.native.llamakvcacheview&.md)<br>