-
Notifications
You must be signed in to change notification settings - Fork 606
Simplest example compilation error #24
Comments
Hi @aokravchenko, We don't allow This error message is Swift unhelpfully telling you that it doesn't know what element type to use. You can tell it by using: let x = Tensor<Float>([[1, 2], [3, 4]]) |
This problem occurred because the Previously, // You can replace `Float` with others `AccelerableByTensorFlow` scalar types like
// `Int32` or `Double`.
let x = Tensor<Float>([[1, 2], [3, 4]])
let x: Tensor<Float> = [[1, 2,], [3, 4]] You might find the new syntax slightly less convenient. However, the new design fixes some long standing issues regarding scalar literal conversion. In addition to tensor-tensor binary operations (like /// Adds the scalar to every scalar of the tensor and produces the sum.
@_inlineable @inline(__always)
public extension Tensor where Scalar : Numeric {
static func + (lhs: Scalar, rhs: Tensor) -> Tensor { ... }
} However, one complication is that // This is a contrived example, the actual circumstances producing
// this bug were more complex.
let bool: Bool = true
// The line below could resolve to `if bool == Tensor(true)` in certain cases,
// which is extremely undesirable.
if bool == true {
...
} Now, You can find more information about literal convertible behavior changes in the commit description if you're interested. I'll update sample code everywhere to work with the new design. |
I updated code examples to account for |
I tried to run in Playground first code example mentioned here:
https://github.com/tensorflow/swift/blob/master/Usage.md
An got this error:
XCode 9.3, MacOS 10.13.4
Toolchain
swift-tensorflow-DEVELOPMENT-2018-05-10-a-osx.pkg
The text was updated successfully, but these errors were encountered: