Post

Replies

Boosts

Views

Activity

CreateMLComponents: Error in Playground
I encountered an error while experimenting with the new CreateMLComponents in playground with the following code: import CreateMLComponents import CoreML var fullyConnected = FullyConnectedNetworkRegressor<Float>.init() fullyConnected.hiddenUnitCounts = [2] let feature: AnnotatedFeature<MLShapedArray<Float>, Float> = .init(feature: .init(scalars: [2, 3], shape: [2]), annotation: 5) let fitted = try? await fullyConnected.fitted(to: [feature, feature]) print(fitted) The generated error message is included (partially) at the end of this post. I later found out that this same code works fine in an actual app. Any insights? The error message: Playground execution failed: error: Execution was interrupted, reason: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0). The process has been left at the point where it was interrupted, use "thread return -x" to return to the state before expression evaluation. * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)   * frame #0: 0x00007ffb2093728d SwiftNN`SwiftNN.Tensor.scalar<œÑ_0_0 where œÑ_0_0: SwiftNN.TensorScalar>(as: œÑ_0_0.Type) -> œÑ_0_0 + 157     frame #1: 0x00007ffb20937cbb SwiftNN`SwiftNN.Tensor.playgroundDescription.getter : Any + 91     frame #2: 0x000000010da43ac4 PlaygroundLogger`___lldb_unnamed_symbol491 + 820     frame #3: 0x000000010da45dbd PlaygroundLogger`___lldb_unnamed_symbol505 + 189 (some more lines ...) PlaygroundLogger`___lldb_unnamed_symbol428 + 124     frame #65: 0x000000010da41dad PlaygroundLogger`playground_log_hidden + 269     frame #66: 0x000000010ca59aba $__lldb_expr14`async_MainTY1_ at CreateMLComp.xcplaygroundpage:12:5     frame #67: 0x000000010ca59fb0 $__lldb_expr14`thunk for @escaping @convention(thin) @async () -> () at <compiler-generated>:0     frame #68: 0x000000010ca5a0c0 $__lldb_expr14`partial apply for thunk for @escaping @convention(thin) @async () -> () at <compiler-generated>:0
2
0
1.4k
Jun ’22
Metal Text Rendering w/ SF Fonts: What's Allowed?
I'm trying to render text with Metal for my (2D) game. I'm using the system fonts, e.g. the SF Pro family for English texts. I render the glyphs onto an atlas texture, and then sample from this texture. My questions: I assume that, for copyright reasons, I'm not allowed to include a pre-rendered font atlas in my app. Is my assumption correct? I can, however, have the app generate the atlas when it's first opened, and then use it within the app, right? If 2. is true, then can the app save the atlas somewhere in the app's private storage, so that it would not need to re-generate the atlas the next time? Thanks!
1
0
1.2k
Mar ’22