Table of Contents

Class IncorrectTypeException

Namespace
NumSharp
Assembly
NumSharp.dll

Raised when a dtype cannot satisfy an operation — the ufunc "no loop matching the specified signature and casting was found", a dtype= request with no matching loop, or a dtype that a function forbids ("i0 not supported for complex values", "x may not be complex"). Every one of these is a NumPy TypeError, which is why this derives from TypeError: a caller writing catch (TypeError) (the way NumPy code writes except TypeError) now catches it, while catch (NumSharpException) still works because TypeError is itself a NumSharpException. Do NOT re-parent this to NumSharpException directly — that silently drops it out of the TypeError hierarchy and reopens the parity gap (a ufunc type error that a catch (TypeError) misses).

public class IncorrectTypeException : TypeError, ISerializable, INumSharpException
Inheritance
IncorrectTypeException
Implements
Inherited Members

Constructors

IncorrectTypeException()

Creates the exception with NumSharp's generic dtype-unsupported message.

public IncorrectTypeException()

IncorrectTypeException(string)

Creates the exception with NumPy's verbatim ufunc/type message.

public IncorrectTypeException(string message)

Parameters

message string

The message, spelled exactly as NumPy 2.4.2 words it, so the differential-fuzz error tier matches byte-for-byte.

IncorrectTypeException(string, Exception)

Creates the exception with the message and the exception that caused it, .NET's standard constructor every NumSharp exception has (Python's raise TypeError(message) from innerException).

public IncorrectTypeException(string message, Exception innerException)

Parameters

message string

The message, kept verbatim (NumPy's text when it mirrors a NumPy failure).

innerException Exception

The exception that led to this one, or null for none.