@@ -193,7 +193,7 @@ struct Chapter7View: View {
193193
194194 // 활성화 함수 비교
195195 result += " == 활성화 함수 비교 == \n "
196- let x = MLXArray ( [ - 2.0 , - 1.0 , 0.0 , 1.0 , 2.0 ] )
196+ let x = MLXArray ( [ - 2.0 , - 1.0 , 0.0 , 1.0 , 2.0 ] as [ Float ] )
197197 result += " 입력 x: \( x) \n \n "
198198
199199 let reluOut = relu ( x)
@@ -218,7 +218,7 @@ struct Chapter7View: View {
218218
219219 // Softmax
220220 result += " == Softmax == \n "
221- let logits = MLXArray ( [ 1.0 , 2.0 , 3.0 , 4.0 ] )
221+ let logits = MLXArray ( [ 1.0 , 2.0 , 3.0 , 4.0 ] as [ Float ] )
222222 let probs = softmax ( logits)
223223 eval ( probs)
224224 result += " Logits: \( logits) \n "
@@ -227,8 +227,8 @@ struct Chapter7View: View {
227227
228228 // MSE Loss
229229 result += " == MSE Loss == \n "
230- let predictions = MLXArray ( [ 1.0 , 2.0 , 3.0 , 4.0 ] )
231- let targets = MLXArray ( [ 1.1 , 2.2 , 2.9 , 3.8 ] )
230+ let predictions = MLXArray ( [ 1.0 , 2.0 , 3.0 , 4.0 ] as [ Float ] )
231+ let targets = MLXArray ( [ 1.1 , 2.2 , 2.9 , 3.8 ] as [ Float ] )
232232 let mse = mean ( square ( predictions - targets) )
233233 eval ( mse)
234234 result += " 예측: \( predictions) \n "
@@ -237,7 +237,7 @@ struct Chapter7View: View {
237237
238238 // Cross-Entropy 데모
239239 result += " == Cross-Entropy 개념 == \n "
240- let classLogits = MLXArray ( [ 2.0 , 1.0 , 0.1 , 0.5 , 2.5 , 0.3 ] ) . reshaped ( [ 2 , 3 ] )
240+ let classLogits = MLXArray ( [ 2.0 , 1.0 , 0.1 , 0.5 , 2.5 , 0.3 ] as [ Float ] ) . reshaped ( [ 2 , 3 ] )
241241 let classProbs = softmax ( classLogits, axis: - 1 )
242242 eval ( classProbs)
243243 result += " Logits: \n \( classLogits) \n "
0 commit comments