Table of Contents

Class UFuncInputCastingError

Namespace
NumSharp
Assembly
NumSharp.dll

NumPy's _UFuncInputCastingError: an input cannot be cast to the loop's dtype under the casting= rule (Cannot cast ufunc 'add' input 0 from dtype('float64') to dtype('int64') with casting rule 'safe').

public class UFuncInputCastingError : UFuncCastingError, ISerializable, INumSharpException
Inheritance
UFuncInputCastingError
Implements
Inherited Members

Remarks

A subclass of UFuncCastingError; it adds in_i, the input's index.

Constructors

UFuncInputCastingError(string, Exception)

Creates the error from a message and the exception that caused it, .NET's standard constructor every NumSharp exception has: the message is kept verbatim, ufunc, casting, from_ and to are null and in_i is 0.

public UFuncInputCastingError(string message, Exception innerException)

Parameters

message string

The verbatim message.

innerException Exception

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

Remarks

Python has no such constructor (NumPy's _UFuncInputCastingError takes the ufunc, the rule, the two dtypes and the index); for code that holds a text only. Footgun: in_i reads 0, a valid index, as the Unicode errors' start does when built from a message.

UFuncInputCastingError(string, int, string, object, object, int)

NumPy's UFuncInputCastingError(ufunc, casting, from, to, i), with the ufunc's input count NumPy reads off the ufunc object.

public UFuncInputCastingError(string ufunc, int nin, string casting, object from_, object to, int i)

Parameters

ufunc string

The ufunc's name.

nin int

The ufunc's input count: the text names the input's index only when it is not 1.

casting string

The rule (safe, same_kind, …).

from_ object

The input's dtype.

to object

The loop's dtype for it.

i int

The input's index.

Exceptions

ArgumentNullException

ufunc is null.

Properties

in_i

The index of the input that cannot be cast (NumPy's in_i); 0 when the error was built from a message alone.

public int in_i { get; }

Property Value

int