mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Added square root function
This commit is contained in:
parent
005087a652
commit
99ee47b79b
@ -147,3 +147,13 @@ class ModulusInvocation(BaseInvocation):
|
|||||||
|
|
||||||
def invoke(self, context: InvocationContext) -> IntegerOutput:
|
def invoke(self, context: InvocationContext) -> IntegerOutput:
|
||||||
return IntegerOutput(value=self.a % self.b)
|
return IntegerOutput(value=self.a % self.b)
|
||||||
|
|
||||||
|
|
||||||
|
@invocation("sqrt", title="Square Root", tags=["math", "sqrt"], category="math", version="1.0.0")
|
||||||
|
class SquareRootInvocation(BaseInvocation):
|
||||||
|
"""Returns the square root of a number."""
|
||||||
|
|
||||||
|
value: float = InputField(default=0, ge=0, description="The float value")
|
||||||
|
|
||||||
|
def invoke(self, context: InvocationContext) -> FloatOutput:
|
||||||
|
return FloatOutput(value=np.sqrt(self.value))
|
Loading…
x
Reference in New Issue
Block a user