Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Jul 1, 2023. It is now read-only.
This repository was archived by the owner on Jul 1, 2023. It is now read-only.

Colab crash using .differentiableReduce() on [Layer] appended with += #1032

Copy link
Copy link
@mikowals

Description

@mikowals
Issue body actions

This code crashes without output in Colab (s4tf v0.10) though it compiles and runs locally on macOS:

import TensorFlow

public struct Network: Layer {
    var blocks: [Conv2D<Float>] = []

    public init() {
        self.blocks += [Conv2D(filterShape: (3, 3, 16, 16))]
    }

    @differentiable
    public func callAsFunction(_ input: Tensor<Float>) -> Tensor<Float> {
        blocks.differentiableReduce(input) { $1($0) }
    }
}

If I don't append with += (just assign blocks to an array or use blocks.append) there is no crash. Also if I just call blocks[0](input) in callAsFunction there is no crash.

The Colab runtime log message before the restarting is a warning:

python3: /swift-base/swift/lib/SILOptimizer/Analysis/Analysis.cpp:33: static void swift::SILAnalysis::verifyFunction(swift::SILFunction *): Assertion `F->isDefinition() && "Can't analyze external functions"' failed.

I came to this reduced error from a larger block of code that worked in v0.9 but is now crashing. So appending with += and calling differentiableReduce was not crashing in that version.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.