This repository was archived by the owner on Mar 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 611
This repository was archived by the owner on Mar 30, 2022. It is now read-only.
Runtime Error: symbol _$s11AllKeyPathss0B12PathIterablePTl
Not Found on macOS #585
Copy link
Copy link
Open
Description
macOS 11.0.1. Xcode 12.2 beta 3. Swift For TensorFlow 0.12. My project successfully builds and links, but I immediately get this runtime error when I'm running my unit tests:
...
[1146/1146] Linking MyModelAppPackageTests
* Build Completed!
error: terminated(1): /Library/Developer/Toolchains/swift-tensorflow-RELEASE-0.12.xctoolchain/usr/libexec/swift/pm/swiftpm-xctest-helper /Users/xander/dev/my_model/.build/x86_64-apple-macosx/debug/MyModelAppPackageTests.xctest /var/folders/zk/5rt0n9yx4p9frf4ybzt_mcz40000gn/T/TemporaryFile.CMRnsY output:
error: unableToLoadBundle("/Users/xander/dev/my_model/.build/x86_64-apple-macosx/debug/MyModelAppPackageTests.xctest")
2020-12-17 12:02:10.911 swiftpm-xctest-helper[30233:7363767] Error loading /Users/xander/dev/my_model/.build/x86_64-apple-macosx/debug/MyModelAppPackageTests.xctest/Contents/MacOS/MyModelAppPackageTests: dlopen(/Users/xander/dev/myp_model/.build/x86_64-apple-macosx/debug/MyModelAppPackageTests.xctest/Contents/MacOS/MyModelAppPackageTests, 265): Symbol not found: _$s11AllKeyPathss0B12PathIterablePTl
Referenced from: /Library/Developer/Toolchains/swift-tensorflow-RELEASE-0.12.xctoolchain/usr/lib/swift/macosx/libswiftTensorFlow.dylib
Expected in: /usr/lib/swift/libswiftCore.dylib
in /Library/Developer/Toolchains/swift-tensorflow-RELEASE-0.12.xctoolchain/usr/lib/swift/macosx/libswiftTensorFlow.dylib
It looks like it can't find the symbol _$s11AllKeyPathss0B12PathIterablePTl
Is it perhaps related to this code in my project:
public extension KeyPathIterable {
/*
This is based on clipByGlobalNorm here:
https://github.com/tensorflow/swift-models/blob/542a03c09aa7bd6e326a18b5d086f2bec8b4b24c/Models/Text/BERT/Utilities.swift#L23
Get all tensors in a gradient and get their min values, max values, and if any values are nan
See a similar hasNaN callback here: https://github.com/tensorflow/swift-models/pull/526/files#diff-2b4e6467b43db097c85ce302b963fefe2ae32a9d42e7147143e0d088a5cc6c55R103
*/
func gradientMinsAndMaxes<Scalar: TensorFlowFloatingPoint>() -> ([Scalar], [Scalar], Bool) {
var mins: [Scalar] = []
var maxes: [Scalar] = []
var hasNan: Bool = false
for kp in self.recursivelyAllWritableKeyPaths(to: Tensor<Scalar>.self) {
let tensor: Tensor<Scalar> = self[keyPath: kp]
mins.append(tensor.min().scalarized())
maxes.append(tensor.max().scalarized())
if hasNan == false {
if tensor.isNaN.any() {
hasNan = true
}
}
}
return (mins, maxes, hasNan)
}
func numParamters<Scalar: TensorFlowFloatingPoint>() -> Scalar {
var numParameters: Scalar = 0
for kp in self.recursivelyAllWritableKeyPaths(to: Tensor<Scalar>.self) {
let tensor: Tensor<Scalar> = self[keyPath: kp]
numParameters += Scalar(tensor.shape.dimensions.cumulativeProduct())
}
return numParameters
}
}
These KeyPathIterable
extensions are very similar to swift-models code here and here.
- Note that this is specific to macOS. The same project using S4TF 0.12 on Linux does not produce this runtime error. The unit tests pass without issue.
- These unit tests do pass without issue on S4TF 0.11 on macOS, this is new with 0.12.
Metadata
Metadata
Assignees
Labels
No labels