Accept suggestion from code review

Co-authored-by: Alejandro Isaza <167236+alejandro-isaza@users.noreply.github.com>
pull/59/head
Pedro Cuenca 3 years ago committed by GitHub
parent 7b4c891147
commit f621a89ccc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -55,7 +55,7 @@ public extension Scheduler {
/// - Returns: sum_i weights[i]*values[i]
func weightedSum(_ weights: [Double], _ values: [MLShapedArray<Float32>]) -> MLShapedArray<Float32> {
assert(weights.count > 1 && values.count == weights.count)
assert(values.allSatisfy({$0.scalarCount == values.first!.scalarCount}))
assert(values.allSatisfy({ $0.scalarCount == values.first!.scalarCount }))
var w = Float(weights.first!)
var scalars = values.first!.scalars.map({ $0 * w })
for next in 1 ..< values.count {

Loading…
Cancel
Save