-func loadWeights(
- from manifest: Manifest,
- at index: Int,
- using weightsData: Data
-) -> MPSGraphTensorData {
- guard manifest.tensors.indices.contains(index) else {
- fatalError("Index out of bounds for tensors array")
- }
+ // A utility function to create a tensor based on the data in the manifest.
+ // Don't come at me for defining a function within a function, this is just to make it clearer to the reader.
+ func loadWeights(from manifest: Manifest, at index: Int, using weightsData: Data) -> MPSGraphTensorData {
+ guard manifest.tensors.indices.contains(index) else {
+ fatalError("Index out of bounds for tensors array")
+ }