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

Tests: add a workaround for type deduction #1114

Merged
merged 1 commit into from
Oct 29, 2020

Conversation

compnerd
Copy link
Contributor

/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.

```
/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.
Copy link
Member

@texasmichelle texasmichelle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about adding a TODO to look at the root cause?

@compnerd compnerd merged commit eb1f1df into tensorflow:master Oct 29, 2020
@compnerd compnerd deleted the conversion-deduction branch October 29, 2020 23:35
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