File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,8 +29,9 @@ final class MLTensorExtensionsTests: XCTestCase {
2929 let tensor = MLTensor ( MLShapedArray < FloatType > ( scalars: expected, shape: [ 3 ] ) )
3030
3131 let result = await tensor. asFloatArray ( )
32+ let expectedFloats : [ Float ] = expected. map { Float ( $0) }
3233
33- assertEqual ( result, expected . map ( Float . init ) , accuracy: 0.0001 )
34+ assertEqual ( result, expectedFloats , accuracy: 0.0001 )
3435 }
3536
3637 func testAsFloatArraySupportsInt32Tensor( ) async {
@@ -47,10 +48,12 @@ final class MLTensorExtensionsTests: XCTestCase {
4748
4849 let result = await tensor. asMLMultiArray ( )
4950 let shapedArray = MLShapedArray < FloatType > ( result)
51+ let resultFloats : [ Float ] = shapedArray. scalars. map { Float ( $0) }
52+ let expectedFloats : [ Float ] = expected. map { Float ( $0) }
5053
5154 XCTAssertEqual ( result. shape, [ 3 ] )
5255 XCTAssertEqual ( shapedArray. scalars. count, expected. count)
53- assertEqual ( shapedArray . scalars . map ( Float . init ) , expected . map ( Float . init ) , accuracy: 0.0001 )
56+ assertEqual ( resultFloats , expectedFloats , accuracy: 0.0001 )
5457 }
5558
5659 func testAsMLMultiArrayRoundTripsInt32Tensor( ) async {
You can’t perform that action at this time.
0 commit comments