Skip to content
This repository was archived by the owner on Jul 1, 2023. It is now read-only.

Revert "Revert "Add Recurrent Layers"" #97

Merged
merged 3 commits into from
Apr 18, 2019
Merged

Conversation

dan-zheng
Copy link
Member

@dan-zheng dan-zheng commented Apr 18, 2019

Reverts #94.


The major blocking crash is fixed in swiftlang/swift#24114.
@differentiable must also be removed from var zeroState to prevent another error/crash.

@dan-zheng
Copy link
Member Author

Confirmed that this test passes (adapted from Tests/DeepLearningTests/LayerTests.swift):

import TensorFlow

let weight = Tensor<Float>(ones: [7, 5]) * Tensor<Float>([0.3333, 1, 0.3333, 1, 0.3333])
let bias = Tensor<Float>(ones: [5])
var cell = SimpleRNNCell<Float>(inputSize: 2, hiddenSize: 5)
cell.weight = weight
cell.bias = bias
let state = Tensor<Float>(ones: [1, 5]) * Tensor<Float>([1, 0.2, 0.5, 2, 0.6])
let input = Tensor<Float>(ones: [1, 2]) * Tensor<Float>([0.3, 0.7])
let output = cell.applied(to: input, state: state).state
let expected = Tensor<Float>([[2.76649, 6.2999997, 2.76649, 6.2999997, 2.76649]])
assert(output == expected)

@dan-zheng dan-zheng requested a review from rxwei April 18, 2019 02:28
@rxwei rxwei merged commit 904dd50 into master Apr 18, 2019
@rxwei rxwei deleted the revert-94-revert-71-master branch April 18, 2019 06:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants