This repository was archived by the owner on Jul 1, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
Sources/TensorFlow/Operators Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -210,6 +210,7 @@ public extension Tensor where Scalar: Equatable {
210
210
public extension Tensor where Scalar: TensorFlowFloatingPoint & Equatable {
211
211
/// Returns a tensor of Boolean values indicating whether the elements of `self` are
212
212
/// approximately equal to those of `other`.
213
+ /// - Precondition: `self` and `other` must be of the same shape.
213
214
@inlinable
214
215
func elementsAlmostEqual(
215
216
_ other: Tensor ,
@@ -229,14 +230,13 @@ public extension StringTensor {
229
230
}
230
231
231
232
public extension Tensor where Scalar: TensorFlowFloatingPoint {
232
- /// Returns `true` if tensors are of equal shape and all pairs of scalars are approximately
233
- /// equal .
233
+ /// Returns `true` if all elements of `self` are approximately equal to those of `other`.
234
+ /// - Precondition: `self` and `other` must be of the same shape .
234
235
@inlinable
235
236
func isAlmostEqual(
236
237
to other: Tensor ,
237
238
tolerance: Scalar = Scalar . ulpOfOne. squareRoot ( )
238
239
) -> Bool {
239
- return self . shape == other. shape &&
240
- self . elementsAlmostEqual ( other, tolerance: tolerance) . all ( )
240
+ elementsAlmostEqual ( other, tolerance: tolerance) . all ( )
241
241
}
242
242
}
You can’t perform that action at this time.
0 commit comments