How to use __call__ method in pyatom

Best Python code snippet using pyatom_python

_callable.py

Source:_callable.py Github

copy

Full Screen

...57 _NumberType_co = TypeVar("_NumberType_co", covariant=True, bound=number)58 _GenericType_co = TypeVar("_GenericType_co", covariant=True, bound=generic)59 class _BoolOp(Protocol[_GenericType_co]):60 @overload61 def __call__(self, __other: _BoolLike) -> _GenericType_co: ...62 @overload # platform dependent63 def __call__(self, __other: int) -> signedinteger[Any]: ...64 @overload65 def __call__(self, __other: float) -> float64: ...66 @overload67 def __call__(self, __other: complex) -> complex128: ...68 @overload69 def __call__(self, __other: _NumberType) -> _NumberType: ...70 class _BoolBitOp(Protocol[_GenericType_co]):71 @overload72 def __call__(self, __other: _BoolLike) -> _GenericType_co: ...73 @overload # platform dependent74 def __call__(self, __other: int) -> signedinteger[Any]: ...75 @overload76 def __call__(self, __other: _IntType) -> _IntType: ...77 class _BoolSub(Protocol):78 # Note that `__other: bool_` is absent here79 @overload80 def __call__(self, __other: bool) -> NoReturn: ...81 @overload # platform dependent82 def __call__(self, __other: int) -> signedinteger[Any]: ...83 @overload84 def __call__(self, __other: float) -> float64: ...85 @overload86 def __call__(self, __other: complex) -> complex128: ...87 @overload88 def __call__(self, __other: _NumberType) -> _NumberType: ...89 class _BoolTrueDiv(Protocol):90 @overload91 def __call__(self, __other: Union[float, _IntLike, _BoolLike]) -> float64: ...92 @overload93 def __call__(self, __other: complex) -> complex128: ...94 @overload95 def __call__(self, __other: _NumberType) -> _NumberType: ...96 class _BoolMod(Protocol):97 @overload98 def __call__(self, __other: _BoolLike) -> int8: ...99 @overload # platform dependent100 def __call__(self, __other: int) -> signedinteger[Any]: ...101 @overload102 def __call__(self, __other: float) -> float64: ...103 @overload104 def __call__(self, __other: _IntType) -> _IntType: ...105 @overload106 def __call__(self, __other: _FloatType) -> _FloatType: ...107 class _BoolDivMod(Protocol):108 @overload109 def __call__(self, __other: _BoolLike) -> _2Tuple[int8]: ...110 @overload # platform dependent111 def __call__(self, __other: int) -> _2Tuple[signedinteger[Any]]: ...112 @overload113 def __call__(self, __other: float) -> _2Tuple[float64]: ...114 @overload115 def __call__(self, __other: _IntType) -> _2Tuple[_IntType]: ...116 @overload117 def __call__(self, __other: _FloatType) -> _2Tuple[_FloatType]: ...118 class _TD64Div(Protocol[_NumberType_co]):119 @overload120 def __call__(self, __other: timedelta64) -> _NumberType_co: ...121 @overload122 def __call__(self, __other: _FloatLike) -> timedelta64: ...123 class _IntTrueDiv(Protocol[_NBit_co]):124 @overload125 def __call__(self, __other: bool) -> floating[_NBit_co]: ...126 @overload127 def __call__(self, __other: int) -> floating[Any]: ...128 @overload129 def __call__(self, __other: float) -> float64: ...130 @overload131 def __call__(self, __other: complex) -> complex128: ...132 @overload133 def __call__(self, __other: integer[_NBit]) -> floating[Union[_NBit_co, _NBit]]: ...134 class _UnsignedIntOp(Protocol[_NBit_co]):135 # NOTE: `uint64 + signedinteger -> float64`136 @overload137 def __call__(self, __other: bool) -> unsignedinteger[_NBit_co]: ...138 @overload139 def __call__(140 self, __other: Union[int, signedinteger[Any]]141 ) -> Any: ...142 @overload143 def __call__(self, __other: float) -> float64: ...144 @overload145 def __call__(self, __other: complex) -> complex128: ...146 @overload147 def __call__(148 self, __other: unsignedinteger[_NBit]149 ) -> unsignedinteger[Union[_NBit_co, _NBit]]: ...150 class _UnsignedIntBitOp(Protocol[_NBit_co]):151 @overload152 def __call__(self, __other: bool) -> unsignedinteger[_NBit_co]: ...153 @overload154 def __call__(self, __other: int) -> signedinteger[Any]: ...155 @overload156 def __call__(self, __other: signedinteger[Any]) -> signedinteger[Any]: ...157 @overload158 def __call__(159 self, __other: unsignedinteger[_NBit]160 ) -> unsignedinteger[Union[_NBit_co, _NBit]]: ...161 class _UnsignedIntMod(Protocol[_NBit_co]):162 @overload163 def __call__(self, __other: bool) -> unsignedinteger[_NBit_co]: ...164 @overload165 def __call__(166 self, __other: Union[int, signedinteger[Any]]167 ) -> Any: ...168 @overload169 def __call__(self, __other: float) -> float64: ...170 @overload171 def __call__(172 self, __other: unsignedinteger[_NBit]173 ) -> unsignedinteger[Union[_NBit_co, _NBit]]: ...174 class _UnsignedIntDivMod(Protocol[_NBit_co]):175 @overload176 def __call__(self, __other: bool) -> _2Tuple[signedinteger[_NBit_co]]: ...177 @overload178 def __call__(179 self, __other: Union[int, signedinteger[Any]]180 ) -> _2Tuple[Any]: ...181 @overload182 def __call__(self, __other: float) -> _2Tuple[float64]: ...183 @overload184 def __call__(185 self, __other: unsignedinteger[_NBit]186 ) -> _2Tuple[unsignedinteger[Union[_NBit_co, _NBit]]]: ...187 class _SignedIntOp(Protocol[_NBit_co]):188 @overload189 def __call__(self, __other: bool) -> signedinteger[_NBit_co]: ...190 @overload191 def __call__(self, __other: int) -> signedinteger[Any]: ...192 @overload193 def __call__(self, __other: float) -> float64: ...194 @overload195 def __call__(self, __other: complex) -> complex128: ...196 @overload197 def __call__(198 self, __other: signedinteger[_NBit]199 ) -> signedinteger[Union[_NBit_co, _NBit]]: ...200 class _SignedIntBitOp(Protocol[_NBit_co]):201 @overload202 def __call__(self, __other: bool) -> signedinteger[_NBit_co]: ...203 @overload204 def __call__(self, __other: int) -> signedinteger[Any]: ...205 @overload206 def __call__(207 self, __other: signedinteger[_NBit]208 ) -> signedinteger[Union[_NBit_co, _NBit]]: ...209 class _SignedIntMod(Protocol[_NBit_co]):210 @overload211 def __call__(self, __other: bool) -> signedinteger[_NBit_co]: ...212 @overload213 def __call__(self, __other: int) -> signedinteger[Any]: ...214 @overload215 def __call__(self, __other: float) -> float64: ...216 @overload217 def __call__(218 self, __other: signedinteger[_NBit]219 ) -> signedinteger[Union[_NBit_co, _NBit]]: ...220 class _SignedIntDivMod(Protocol[_NBit_co]):221 @overload222 def __call__(self, __other: bool) -> _2Tuple[signedinteger[_NBit_co]]: ...223 @overload224 def __call__(self, __other: int) -> _2Tuple[signedinteger[Any]]: ...225 @overload226 def __call__(self, __other: float) -> _2Tuple[float64]: ...227 @overload228 def __call__(229 self, __other: signedinteger[_NBit]230 ) -> _2Tuple[signedinteger[Union[_NBit_co, _NBit]]]: ...231 class _FloatOp(Protocol[_NBit_co]):232 @overload233 def __call__(self, __other: bool) -> floating[_NBit_co]: ...234 @overload235 def __call__(self, __other: int) -> floating[Any]: ...236 @overload237 def __call__(self, __other: float) -> float64: ...238 @overload239 def __call__(self, __other: complex) -> complex128: ...240 @overload241 def __call__(242 self, __other: Union[integer[_NBit], floating[_NBit]]243 ) -> floating[Union[_NBit_co, _NBit]]: ...244 class _FloatMod(Protocol[_NBit_co]):245 @overload246 def __call__(self, __other: bool) -> floating[_NBit_co]: ...247 @overload248 def __call__(self, __other: int) -> floating[Any]: ...249 @overload250 def __call__(self, __other: float) -> float64: ...251 @overload252 def __call__(253 self, __other: Union[integer[_NBit], floating[_NBit]]254 ) -> floating[Union[_NBit_co, _NBit]]: ...255 class _FloatDivMod(Protocol[_NBit_co]):256 @overload257 def __call__(self, __other: bool) -> _2Tuple[floating[_NBit_co]]: ...258 @overload259 def __call__(self, __other: int) -> _2Tuple[floating[Any]]: ...260 @overload261 def __call__(self, __other: float) -> _2Tuple[float64]: ...262 @overload263 def __call__(264 self, __other: Union[integer[_NBit], floating[_NBit]]265 ) -> _2Tuple[floating[Union[_NBit_co, _NBit]]]: ...266 class _ComplexOp(Protocol[_NBit_co]):267 @overload268 def __call__(self, __other: bool) -> complexfloating[_NBit_co, _NBit_co]: ...269 @overload270 def __call__(self, __other: int) -> complexfloating[Any, Any]: ...271 @overload272 def __call__(self, __other: Union[float, complex]) -> complex128: ...273 @overload274 def __call__(275 self,276 __other: Union[277 integer[_NBit],278 floating[_NBit],279 complexfloating[_NBit, _NBit],280 ]281 ) -> complexfloating[Union[_NBit_co, _NBit], Union[_NBit_co, _NBit]]: ...282 class _NumberOp(Protocol):283 def __call__(self, __other: _NumberLike) -> number: ...284else:285 _BoolOp = Any286 _BoolBitOp = Any287 _BoolSub = Any288 _BoolTrueDiv = Any289 _BoolMod = Any290 _BoolDivMod = Any291 _TD64Div = Any292 _IntTrueDiv = Any293 _UnsignedIntOp = Any294 _UnsignedIntBitOp = Any295 _UnsignedIntMod = Any296 _UnsignedIntDivMod = Any297 _SignedIntOp = Any...

Full Screen

Full Screen

_callable.pyi

Source:_callable.pyi Github

copy

Full Screen

...63_GenericType_co = TypeVar("_GenericType_co", covariant=True, bound=generic)6465class _BoolOp(Protocol[_GenericType_co]):66 @overload67 def __call__(self, other: _BoolLike_co, /) -> _GenericType_co: ...68 @overload # platform dependent69 def __call__(self, other: int, /) -> int_: ...70 @overload71 def __call__(self, other: float, /) -> float64: ...72 @overload73 def __call__(self, other: complex, /) -> complex128: ...74 @overload75 def __call__(self, other: _NumberType, /) -> _NumberType: ...7677class _BoolBitOp(Protocol[_GenericType_co]):78 @overload79 def __call__(self, other: _BoolLike_co, /) -> _GenericType_co: ...80 @overload # platform dependent81 def __call__(self, other: int, /) -> int_: ...82 @overload83 def __call__(self, other: _IntType, /) -> _IntType: ...8485class _BoolSub(Protocol):86 # Note that `other: bool_` is absent here87 @overload88 def __call__(self, other: bool, /) -> NoReturn: ...89 @overload # platform dependent90 def __call__(self, other: int, /) -> int_: ...91 @overload92 def __call__(self, other: float, /) -> float64: ...93 @overload94 def __call__(self, other: complex, /) -> complex128: ...95 @overload96 def __call__(self, other: _NumberType, /) -> _NumberType: ...9798class _BoolTrueDiv(Protocol):99 @overload100 def __call__(self, other: float | _IntLike_co, /) -> float64: ...101 @overload102 def __call__(self, other: complex, /) -> complex128: ...103 @overload104 def __call__(self, other: _NumberType, /) -> _NumberType: ...105106class _BoolMod(Protocol):107 @overload108 def __call__(self, other: _BoolLike_co, /) -> int8: ...109 @overload # platform dependent110 def __call__(self, other: int, /) -> int_: ...111 @overload112 def __call__(self, other: float, /) -> float64: ...113 @overload114 def __call__(self, other: _IntType, /) -> _IntType: ...115 @overload116 def __call__(self, other: _FloatType, /) -> _FloatType: ...117118class _BoolDivMod(Protocol):119 @overload120 def __call__(self, other: _BoolLike_co, /) -> _2Tuple[int8]: ...121 @overload # platform dependent122 def __call__(self, other: int, /) -> _2Tuple[int_]: ...123 @overload124 def __call__(self, other: float, /) -> _2Tuple[floating[_NBit1 | _NBitDouble]]: ...125 @overload126 def __call__(self, other: _IntType, /) -> _2Tuple[_IntType]: ...127 @overload128 def __call__(self, other: _FloatType, /) -> _2Tuple[_FloatType]: ...129130class _TD64Div(Protocol[_NumberType_co]):131 @overload132 def __call__(self, other: timedelta64, /) -> _NumberType_co: ...133 @overload134 def __call__(self, other: _BoolLike_co, /) -> NoReturn: ...135 @overload136 def __call__(self, other: _FloatLike_co, /) -> timedelta64: ...137138class _IntTrueDiv(Protocol[_NBit1]):139 @overload140 def __call__(self, other: bool, /) -> floating[_NBit1]: ...141 @overload142 def __call__(self, other: int, /) -> floating[_NBit1 | _NBitInt]: ...143 @overload144 def __call__(self, other: float, /) -> floating[_NBit1 | _NBitDouble]: ...145 @overload146 def __call__(147 self, other: complex, /,148 ) -> complexfloating[_NBit1 | _NBitDouble, _NBit1 | _NBitDouble]: ...149 @overload150 def __call__(self, other: integer[_NBit2], /) -> floating[_NBit1 | _NBit2]: ...151152class _UnsignedIntOp(Protocol[_NBit1]):153 # NOTE: `uint64 + signedinteger -> float64`154 @overload155 def __call__(self, other: bool, /) -> unsignedinteger[_NBit1]: ...156 @overload157 def __call__(158 self, other: int | signedinteger[Any], /159 ) -> Any: ...160 @overload161 def __call__(self, other: float, /) -> floating[_NBit1 | _NBitDouble]: ...162 @overload163 def __call__(164 self, other: complex, /,165 ) -> complexfloating[_NBit1 | _NBitDouble, _NBit1 | _NBitDouble]: ...166 @overload167 def __call__(168 self, other: unsignedinteger[_NBit2], /169 ) -> unsignedinteger[_NBit1 | _NBit2]: ...170171class _UnsignedIntBitOp(Protocol[_NBit1]):172 @overload173 def __call__(self, other: bool, /) -> unsignedinteger[_NBit1]: ...174 @overload175 def __call__(self, other: int, /) -> signedinteger[Any]: ...176 @overload177 def __call__(self, other: signedinteger[Any], /) -> signedinteger[Any]: ...178 @overload179 def __call__(180 self, other: unsignedinteger[_NBit2], /181 ) -> unsignedinteger[_NBit1 | _NBit2]: ...182183class _UnsignedIntMod(Protocol[_NBit1]):184 @overload185 def __call__(self, other: bool, /) -> unsignedinteger[_NBit1]: ...186 @overload187 def __call__(188 self, other: int | signedinteger[Any], /189 ) -> Any: ...190 @overload191 def __call__(self, other: float, /) -> floating[_NBit1 | _NBitDouble]: ...192 @overload193 def __call__(194 self, other: unsignedinteger[_NBit2], /195 ) -> unsignedinteger[_NBit1 | _NBit2]: ...196197class _UnsignedIntDivMod(Protocol[_NBit1]):198 @overload199 def __call__(self, other: bool, /) -> _2Tuple[signedinteger[_NBit1]]: ...200 @overload201 def __call__(202 self, other: int | signedinteger[Any], /203 ) -> _2Tuple[Any]: ...204 @overload205 def __call__(self, other: float, /) -> _2Tuple[floating[_NBit1 | _NBitDouble]]: ...206 @overload207 def __call__(208 self, other: unsignedinteger[_NBit2], /209 ) -> _2Tuple[unsignedinteger[_NBit1 | _NBit2]]: ...210211class _SignedIntOp(Protocol[_NBit1]):212 @overload213 def __call__(self, other: bool, /) -> signedinteger[_NBit1]: ...214 @overload215 def __call__(self, other: int, /) -> signedinteger[_NBit1 | _NBitInt]: ...216 @overload217 def __call__(self, other: float, /) -> floating[_NBit1 | _NBitDouble]: ...218 @overload219 def __call__(220 self, other: complex, /,221 ) -> complexfloating[_NBit1 | _NBitDouble, _NBit1 | _NBitDouble]: ...222 @overload223 def __call__(224 self, other: signedinteger[_NBit2], /,225 ) -> signedinteger[_NBit1 | _NBit2]: ...226227class _SignedIntBitOp(Protocol[_NBit1]):228 @overload229 def __call__(self, other: bool, /) -> signedinteger[_NBit1]: ...230 @overload231 def __call__(self, other: int, /) -> signedinteger[_NBit1 | _NBitInt]: ...232 @overload233 def __call__(234 self, other: signedinteger[_NBit2], /,235 ) -> signedinteger[_NBit1 | _NBit2]: ...236237class _SignedIntMod(Protocol[_NBit1]):238 @overload239 def __call__(self, other: bool, /) -> signedinteger[_NBit1]: ...240 @overload241 def __call__(self, other: int, /) -> signedinteger[_NBit1 | _NBitInt]: ...242 @overload243 def __call__(self, other: float, /) -> floating[_NBit1 | _NBitDouble]: ...244 @overload245 def __call__(246 self, other: signedinteger[_NBit2], /,247 ) -> signedinteger[_NBit1 | _NBit2]: ...248249class _SignedIntDivMod(Protocol[_NBit1]):250 @overload251 def __call__(self, other: bool, /) -> _2Tuple[signedinteger[_NBit1]]: ...252 @overload253 def __call__(self, other: int, /) -> _2Tuple[signedinteger[_NBit1 | _NBitInt]]: ...254 @overload255 def __call__(self, other: float, /) -> _2Tuple[floating[_NBit1 | _NBitDouble]]: ...256 @overload257 def __call__(258 self, other: signedinteger[_NBit2], /,259 ) -> _2Tuple[signedinteger[_NBit1 | _NBit2]]: ...260261class _FloatOp(Protocol[_NBit1]):262 @overload263 def __call__(self, other: bool, /) -> floating[_NBit1]: ...264 @overload265 def __call__(self, other: int, /) -> floating[_NBit1 | _NBitInt]: ...266 @overload267 def __call__(self, other: float, /) -> floating[_NBit1 | _NBitDouble]: ...268 @overload269 def __call__(270 self, other: complex, /,271 ) -> complexfloating[_NBit1 | _NBitDouble, _NBit1 | _NBitDouble]: ...272 @overload273 def __call__(274 self, other: integer[_NBit2] | floating[_NBit2], /275 ) -> floating[_NBit1 | _NBit2]: ...276277class _FloatMod(Protocol[_NBit1]):278 @overload279 def __call__(self, other: bool, /) -> floating[_NBit1]: ...280 @overload281 def __call__(self, other: int, /) -> floating[_NBit1 | _NBitInt]: ...282 @overload283 def __call__(self, other: float, /) -> floating[_NBit1 | _NBitDouble]: ...284 @overload285 def __call__(286 self, other: integer[_NBit2] | floating[_NBit2], /287 ) -> floating[_NBit1 | _NBit2]: ...288289class _FloatDivMod(Protocol[_NBit1]):290 @overload291 def __call__(self, other: bool, /) -> _2Tuple[floating[_NBit1]]: ...292 @overload293 def __call__(self, other: int, /) -> _2Tuple[floating[_NBit1 | _NBitInt]]: ...294 @overload295 def __call__(self, other: float, /) -> _2Tuple[floating[_NBit1 | _NBitDouble]]: ...296 @overload297 def __call__(298 self, other: integer[_NBit2] | floating[_NBit2], /299 ) -> _2Tuple[floating[_NBit1 | _NBit2]]: ...300301class _ComplexOp(Protocol[_NBit1]):302 @overload303 def __call__(self, other: bool, /) -> complexfloating[_NBit1, _NBit1]: ...304 @overload305 def __call__(self, other: int, /) -> complexfloating[_NBit1 | _NBitInt, _NBit1 | _NBitInt]: ...306 @overload307 def __call__(308 self, other: complex, /,309 ) -> complexfloating[_NBit1 | _NBitDouble, _NBit1 | _NBitDouble]: ...310 @overload311 def __call__(312 self,313 other: Union[314 integer[_NBit2],315 floating[_NBit2],316 complexfloating[_NBit2, _NBit2],317 ], /,318 ) -> complexfloating[_NBit1 | _NBit2, _NBit1 | _NBit2]: ...319320class _NumberOp(Protocol):321 def __call__(self, other: _NumberLike_co, /) -> Any: ...322323class _ComparisonOp(Protocol[_T1_contra, _T2_contra]):324 @overload325 def __call__(self, other: _T1_contra, /) -> bool_: ...326 @overload ...

Full Screen

Full Screen

activation_functions.py

Source:activation_functions.py Github

copy

Full Screen

2import numpy as np3# Collection of activation functions4# Reference: https://en.wikipedia.org/wiki/Activation_function5class Sigmoid(object):6 def __call__(self, x):7 return 1 / (1 + np.exp(-x))8 def gradient(self, x):9 return self.__call__(x) * (1 - self.__call__(x))10class Softmax(object):11 def __call__(self, x):12 e_x = np.exp(x - np.max(x, axis=-1, keepdims=True))13 return e_x / np.sum(e_x, axis=-1, keepdims=True)14 def gradient(self, x):15 p = self.__call__(x)16 return p * (1 - p)17class TanH(object):18 def __call__(self, x):19 return 2 / (1 + np.exp(-2 * x)) - 120 def gradient(self, x):21 return 1 - np.power(self.__call__(x), 2)22class ReLU(object):23 def __call__(self, x):24 return np.where(x >= 0, x, 0)25 def gradient(self, x):26 return np.where(x >= 0, 1, 0)27class LeakyReLU(object):28 def __init__(self, alpha=0.2):29 self.alpha = alpha30 def __call__(self, x):31 return np.where(x >= 0, x, self.alpha * x)32 def gradient(self, x):33 return np.where(x >= 0, 1, self.alpha)34class ELU(object):35 def __init__(self, alpha=0.1):36 self.alpha = alpha37 def __call__(self, x):38 return np.where(x >= 0.0, x, self.alpha * (np.exp(x) - 1))39 def gradient(self, x):40 return np.where(x >= 0.0, 1, self.__call__(x) + self.alpha)41class SELU(object):42 # Reference : https://arxiv.org/abs/1706.02515,43 # https://github.com/bioinf-jku/SNNs/blob/master/SelfNormalizingNetworks_MLP_MNIST.ipynb44 def __init__(self):45 self.alpha = 1.673263242354377284817042991671746 self.scale = 1.050700987355480493419334985294647 def __call__(self, x):48 return self.scale * np.where(x >= 0.0, x, self.alpha * (np.exp(x) - 1))49 def gradient(self, x):50 return self.scale * np.where(x >= 0.0, 1, self.alpha * np.exp(x))51class SoftPlus(object):52 def __call__(self, x):53 return np.log(1 + np.exp(x))54 def gradient(self, x):...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run pyatom automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful