Skip to content

Commit

Permalink
fixed bug in Tensor that collapses a singleton dimension if was speci…
Browse files Browse the repository at this point in the history
…fied, but the dimension was of size one
  • Loading branch information
abeschneider committed Jan 13, 2017
1 parent 065f237 commit 86d3660
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Sources/Tensor/tensor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -295,13 +295,14 @@ open class Tensor<StorageType:Storage> {
return tensor.shape[$0.0]
}

return $0.1.last! - $0.1.first! + 1
let width = $0.1.last! - $0.1.first! + 1
return width == 1 ? -1 : width
}.filter {
return $0 > 1
return $0 >= 1
})

fixedDims = window.enumerated().map {
let singleton = Bool($0.1.first == $0.1.last && $0.1.first != nil)
let singleton = Bool($0.1.first != nil && $0.1.first == $0.1.last) // && $0.1.first != nil
return singleton ? Int($0.element.lowerBound) : -1
}

Expand Down

0 comments on commit 86d3660

Please sign in to comment.