TensorPrimitives.HammingDistance<T> Method

Definition

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

x
ReadOnlySpan<T>

The first tensor, represented as a span.

y
ReadOnlySpan<T>

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