E-TE0012 — Expression is not a function
Error Type |
|
|---|---|
Phase |
type checking the model |
Python exception |
|
Message
Expected a function, but got {got}{...}.
Possible fix: pass a function (e.g. a lambda), or remove the extra argument(s).
Cause
Arguments were applied to an expression that is not a function.
This can happen in three ways.
Applying arguments to a construct that can never be a function, such as a tuple, list, dict, set, tensor, comparison, range, or slice — for example (a, b)(3); in this case the message names the kind of construct, such as “a tuple expression”.
Calling a value whose type is not a function type — for example x(3) where x is a scalar placeholder; the message then reports the expression’s type, such as “an expression of type int”.
Applying more arguments than the function accepts — for example f(1)(2) for a one-argument f; the message then describes the non-function result that remains after the accepted arguments are consumed.
The message also lists the types of the arguments, in the order they are applied.
In the third case, it lists only the extra arguments.
Fix
Pass a function (e.g. a Python lambda) where one is expected, or remove the extra argument(s). The message describes what the called expression actually is.