Skip to content

Commit 4ae925c

Browse files
author
marcrasi
authored
remove algorithms that are in penguin now (#195)
saeta/penguin#120 moved these into Penguin. For some reason, defining them in both places causes a compiler crash. This PR fixes #194.
1 parent cfcbe9a commit 4ae925c

File tree

4 files changed

+4
-63
lines changed

4 files changed

+4
-63
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
uses: actions/checkout@master
1010
- name: Install toolchain
1111
run: |
12-
sudo xcode-select -s /Applications/Xcode_12_beta.app
12+
sudo xcode-select -s /Applications/Xcode_12.2.app
1313
wget https://storage.googleapis.com/swift-tensorflow-artifacts/macos-toolchains/swift-tensorflow-DEVELOPMENT-2020-08-26-a-osx.pkg
1414
sudo installer -pkg swift-tensorflow-DEVELOPMENT-2020-08-26-a-osx.pkg -target /
1515
echo "::set-env name=PATH::/Library/Developer/Toolchains/swift-latest/usr/bin:${PATH}"

Package.resolved

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/SwiftFusion/Core/Vector.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Foundation
2+
import PenguinStructures
23
import TensorFlow
34

45
/// A vector, in a Euclidean vector space with standard orthonormal basis.

Sources/SwiftFusion/Inference/PenguinExtensions.swift

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -754,66 +754,6 @@ extension Dictionary {
754754
}
755755
}
756756

757-
extension MutableCollection {
758-
mutating func writePrefix<I: IteratorProtocol>(from source: inout I)
759-
-> (writtenCount: Int, unwrittenStart: Index)
760-
where I.Element == Element
761-
{
762-
var writtenCount = 0
763-
var unwrittenStart = startIndex
764-
while unwrittenStart != endIndex {
765-
guard let x = source.next() else { break }
766-
self[unwrittenStart] = x
767-
self.formIndex(after: &unwrittenStart)
768-
writtenCount += 1
769-
}
770-
return (writtenCount, unwrittenStart)
771-
}
772-
773-
mutating func writePrefix<Source: Collection>(from source: Source)
774-
-> (writtenCount: Int, unwrittenStart: Index, unreadStart: Source.Index)
775-
where Source.Element == Element
776-
{
777-
var writtenCount = 0
778-
var unwrittenStart = startIndex
779-
var unreadStart = source.startIndex
780-
while unwrittenStart != endIndex && unreadStart != source.endIndex {
781-
self[unwrittenStart] = source[unreadStart]
782-
self.formIndex(after: &unwrittenStart)
783-
source.formIndex(after: &unreadStart)
784-
writtenCount += 1
785-
}
786-
return (writtenCount, unwrittenStart, unreadStart)
787-
}
788-
789-
@discardableResult
790-
mutating func assign<Source: Sequence>(_ sourceElements: Source) -> Int
791-
where Source.Element == Element
792-
{
793-
var stream = sourceElements.makeIterator()
794-
let (count, unwritten) = writePrefix(from: &stream)
795-
precondition(unwritten == endIndex, "source too short")
796-
precondition(stream.next() == nil, "source too long")
797-
return count
798-
}
799-
800-
@discardableResult
801-
mutating func assign<Source: Collection>(_ sourceElements: Source) -> Int
802-
where Source.Element == Element
803-
{
804-
let (writtenCount, unwritten, unread) = writePrefix(from: sourceElements)
805-
precondition(unwritten == endIndex, "source too short")
806-
precondition(unread == sourceElements.endIndex, "source too long")
807-
return writtenCount
808-
}
809-
}
810-
811-
extension Collection {
812-
func index(atOffset n: Int) -> Index {
813-
index(startIndex, offsetBy: n)
814-
}
815-
}
816-
817757
/// The consecutive `SubSequence`s of a `Base` collection having a given maximum size.
818758
struct Batched<Base: Collection>: Collection {
819759
public let base: Base

0 commit comments

Comments
 (0)