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

Commit eb1f1df

Browse files
authored
Tests: add a workaround for type deduction (#1114)
``` /SourceCache/tensorflow-swift-apis/Tests/TensorFlowTests/TensorAutoDiffTests.swift:616:17: error: cannot convert value of type 'Tensor<Float>.TangentVector' (aka 'Tensor<Float>') to expected argument type 'Tensor<Double>' assertEqual(gradient(at: [-1, 0, 1], in: f), [0.1966119, 0.25, 0.1966119], accuracy: 0.0001) ^ ``` For some reason the gradient is being deduced as `Tensor<Double>` which does not match the expectation of a `Tensor<Float>`. Provide an explicit conversion to workaround the issue.
1 parent 7465fdb commit eb1f1df

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Tests/TensorFlowTests/TensorAutoDiffTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ final class TensorAutoDiffTests: XCTestCase {
613613

614614
func testSigmoid() {
615615
func f(a: Tensor<Float>) -> Tensor<Float> { sigmoid(a).sum() }
616-
assertEqual(gradient(at: [-1, 0, 1], in: f), [0.1966119, 0.25, 0.1966119], accuracy: 0.0001)
616+
assertEqual(Tensor<Float>(gradient(at: [-1, 0, 1], in: f)), [0.1966119, 0.25, 0.1966119], accuracy: 0.0001)
617617
}
618618

619619
func testRelu() {

0 commit comments

Comments
 (0)