diff --git a/Sources/DeepLearning/Operators/Math.swift b/Sources/DeepLearning/Operators/Math.swift index 9a2cecebf..3255aea10 100644 --- a/Sources/DeepLearning/Operators/Math.swift +++ b/Sources/DeepLearning/Operators/Math.swift @@ -875,7 +875,7 @@ public extension Tensor where Scalar == Bool { @inlinable func all() -> Bool { let axes = Tensor(rangeFrom: 0, to: Int32(rank), stride: 1) - return Raw.all(self, reductionIndices: axes).scalarized() + return _TFGetScalarOrDie(Raw.all(self, reductionIndices: axes).handle) } /// Returns `true` if any scalars are equal to `true`. Otherwise, returns `false`. @@ -884,7 +884,7 @@ public extension Tensor where Scalar == Bool { @inlinable func any() -> Bool { let axes = Tensor(rangeFrom: 0, to: Int32(rank), stride: 1) - return Raw.any(self, reductionIndices: axes).scalarized() + return _TFGetScalarOrDie(Raw.any(self, reductionIndices: axes).handle) } /// Performs a logical AND operation along the specified axes. The reduced dimensions are diff --git a/Sources/DeepLearning/Tensors.swift b/Sources/DeepLearning/Tensors.swift index ad6f758a6..1c1700649 100644 --- a/Sources/DeepLearning/Tensors.swift +++ b/Sources/DeepLearning/Tensors.swift @@ -27,21 +27,18 @@ infix operator .==: ComparisonPrecedence public extension Tensor { /// The rank of the tensor, represented as a `Tensor`. @inlinable - @_semantics("autodiff.nonvarying") var rankTensor: Tensor { return Raw.rank(self) } /// The dimensions of the tensor, represented as a `Tensor`. @inlinable - @_semantics("autodiff.nonvarying") var shapeTensor: Tensor { return Raw.shape(self) } /// The number of scalars in the tensor, represented as a `Tensor`. @inlinable - @_semantics("autodiff.nonvarying") var scalarCountTensor: Tensor { return Raw.size(self) } @@ -56,7 +53,6 @@ extension Tensor: CustomStringConvertible { /// A textual representation of the tensor. /// /// - Note: use `fullDescription` for a non-pretty-printed description showing all scalars. - @_semantics("autodiff.nonvarying") public var description: String { return array.description } @@ -73,7 +69,6 @@ public extension Tensor { /// via ellipses (`...`). /// - summarizing: If true, summarize description if element count exceeds twice /// `edgeElementCount`. - @_semantics("autodiff.nonvarying") func description( lineWidth: Int = 80, edgeElementCount: Int = 3, @@ -87,7 +82,6 @@ public extension Tensor { /// A full, non-pretty-printed textual representation of the tensor, showing /// all scalars. - @_semantics("autodiff.nonvarying") var fullDescription: String { return array.fullDescription } @@ -95,7 +89,6 @@ public extension Tensor { // Xcode Playground display conversion. extension Tensor: CustomPlaygroundDisplayConvertible { - @_semantics("autodiff.nonvarying") public var playgroundDescription: Any { return description } @@ -103,7 +96,6 @@ extension Tensor: CustomPlaygroundDisplayConvertible { // Mirror representation, used by debugger/REPL. extension Tensor: CustomReflectable { - @_semantics("autodiff.nonvarying") public var customMirror: Mirror { return Mirror(self, children: [], displayStyle: .struct) }