TensorPrimitives.HammingDistance<T> Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Computes the Hamming distance between two equal-length tensors of values.
public:
generic <typename T>
static int HammingDistance(ReadOnlySpan<T> x, ReadOnlySpan<T> y);
public static int HammingDistance<T> (ReadOnlySpan<T> x, ReadOnlySpan<T> y);
static member HammingDistance : ReadOnlySpan<'T> * ReadOnlySpan<'T> -> int
Public Shared Function HammingDistance(Of T) (x As ReadOnlySpan(Of T), y As ReadOnlySpan(Of T)) As Integer
Type Parameters
- T
Parameters
The first tensor, represented as a span.
The second tensor, represented as a span.
Returns
The number of elements that differ between the two spans.
Exceptions
x
and y
must not be empty.
Remarks
This method computes the number of locations i
where !EqualityComparer>T<.Default.Equal(x[i], y[i])
.
Applies to
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.