mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
[torchfuzz] remove supports_variable_inputs for now (#163553)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/163553 Approved by: https://github.com/laithsakka ghstack dependencies: #163547
This commit is contained in:
parent
fcd79d5228
commit
0e122380c2
|
|
@ -21,10 +21,6 @@ class AddOperator(Operator):
|
||||||
"""Add can produce tensors but not scalars."""
|
"""Add can produce tensors but not scalars."""
|
||||||
return isinstance(output_spec, TensorSpec)
|
return isinstance(output_spec, TensorSpec)
|
||||||
|
|
||||||
def supports_variable_inputs(self) -> bool:
|
|
||||||
"""Add operator supports variable number of inputs."""
|
|
||||||
return True
|
|
||||||
|
|
||||||
def decompose(self, output_spec: Spec, num_inputs: int = 2) -> list[Spec]:
|
def decompose(self, output_spec: Spec, num_inputs: int = 2) -> list[Spec]:
|
||||||
"""Decompose tensor into input tensors for addition with type promotion."""
|
"""Decompose tensor into input tensors for addition with type promotion."""
|
||||||
if not isinstance(output_spec, TensorSpec):
|
if not isinstance(output_spec, TensorSpec):
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,6 @@ class ArgOperator(Operator):
|
||||||
"""Arg can produce any type of output."""
|
"""Arg can produce any type of output."""
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def supports_variable_inputs(self) -> bool:
|
|
||||||
"""Arg operator does not require inputs."""
|
|
||||||
return False
|
|
||||||
|
|
||||||
def decompose(self, output_spec: Spec, num_inputs: int = 0) -> list[Spec]:
|
def decompose(self, output_spec: Spec, num_inputs: int = 0) -> list[Spec]:
|
||||||
"""Arg requires no inputs."""
|
"""Arg requires no inputs."""
|
||||||
return []
|
return []
|
||||||
|
|
|
||||||
|
|
@ -16,10 +16,6 @@ class Operator(ABC):
|
||||||
def can_produce(self, output_spec: Spec) -> bool:
|
def can_produce(self, output_spec: Spec) -> bool:
|
||||||
"""Check if this operator can produce the given output spec."""
|
"""Check if this operator can produce the given output spec."""
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def supports_variable_inputs(self) -> bool:
|
|
||||||
"""Check if this operator supports variable number of inputs."""
|
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def decompose(self, output_spec: Spec, num_inputs: int = 2) -> list[Spec]:
|
def decompose(self, output_spec: Spec, num_inputs: int = 2) -> list[Spec]:
|
||||||
"""Decompose output spec into input specs."""
|
"""Decompose output spec into input specs."""
|
||||||
|
|
|
||||||
|
|
@ -20,10 +20,6 @@ class ConstantOperator(Operator):
|
||||||
"""Constant can produce any type of output."""
|
"""Constant can produce any type of output."""
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def supports_variable_inputs(self) -> bool:
|
|
||||||
"""Constant operator does not require inputs."""
|
|
||||||
return False
|
|
||||||
|
|
||||||
def decompose(self, output_spec: Spec, num_inputs: int = 0) -> list[Spec]:
|
def decompose(self, output_spec: Spec, num_inputs: int = 0) -> list[Spec]:
|
||||||
"""Constant requires no inputs."""
|
"""Constant requires no inputs."""
|
||||||
return []
|
return []
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,6 @@ class ItemOperator(Operator):
|
||||||
"""Item can only produce scalars."""
|
"""Item can only produce scalars."""
|
||||||
return isinstance(output_spec, ScalarSpec)
|
return isinstance(output_spec, ScalarSpec)
|
||||||
|
|
||||||
def supports_variable_inputs(self) -> bool:
|
|
||||||
"""Item operator does not support variable number of inputs."""
|
|
||||||
return False
|
|
||||||
|
|
||||||
def decompose(self, output_spec: Spec, num_inputs: int = 1) -> list[Spec]:
|
def decompose(self, output_spec: Spec, num_inputs: int = 1) -> list[Spec]:
|
||||||
"""Decompose scalar into a single-element tensor for item operation."""
|
"""Decompose scalar into a single-element tensor for item operation."""
|
||||||
if not isinstance(output_spec, ScalarSpec):
|
if not isinstance(output_spec, ScalarSpec):
|
||||||
|
|
|
||||||
|
|
@ -16,10 +16,6 @@ class MulOperator(Operator):
|
||||||
"""Mul can produce tensors but not scalars."""
|
"""Mul can produce tensors but not scalars."""
|
||||||
return isinstance(output_spec, TensorSpec)
|
return isinstance(output_spec, TensorSpec)
|
||||||
|
|
||||||
def supports_variable_inputs(self) -> bool:
|
|
||||||
"""Mul operator supports variable number of inputs."""
|
|
||||||
return True
|
|
||||||
|
|
||||||
def decompose(self, output_spec: Spec, num_inputs: int = 2) -> list[Spec]:
|
def decompose(self, output_spec: Spec, num_inputs: int = 2) -> list[Spec]:
|
||||||
"""Decompose tensor into input tensors for multiplication with type promotion."""
|
"""Decompose tensor into input tensors for multiplication with type promotion."""
|
||||||
if not isinstance(output_spec, TensorSpec):
|
if not isinstance(output_spec, TensorSpec):
|
||||||
|
|
|
||||||
|
|
@ -16,10 +16,6 @@ class ScalarAddOperator(Operator):
|
||||||
"""Scalar add can only produce scalars."""
|
"""Scalar add can only produce scalars."""
|
||||||
return isinstance(output_spec, ScalarSpec)
|
return isinstance(output_spec, ScalarSpec)
|
||||||
|
|
||||||
def supports_variable_inputs(self) -> bool:
|
|
||||||
"""Scalar add operator does not support variable number of inputs."""
|
|
||||||
return False
|
|
||||||
|
|
||||||
def decompose(self, output_spec: Spec, num_inputs: int = 2) -> list[Spec]:
|
def decompose(self, output_spec: Spec, num_inputs: int = 2) -> list[Spec]:
|
||||||
"""Decompose scalar into input scalars for addition with type promotion."""
|
"""Decompose scalar into input scalars for addition with type promotion."""
|
||||||
if not isinstance(output_spec, ScalarSpec):
|
if not isinstance(output_spec, ScalarSpec):
|
||||||
|
|
|
||||||
|
|
@ -16,10 +16,6 @@ class ScalarMultiplyOperator(Operator):
|
||||||
"""Scalar multiply can only produce scalars."""
|
"""Scalar multiply can only produce scalars."""
|
||||||
return isinstance(output_spec, ScalarSpec)
|
return isinstance(output_spec, ScalarSpec)
|
||||||
|
|
||||||
def supports_variable_inputs(self) -> bool:
|
|
||||||
"""Scalar multiply operator does not support variable number of inputs."""
|
|
||||||
return False
|
|
||||||
|
|
||||||
def decompose(self, output_spec: Spec, num_inputs: int = 2) -> list[Spec]:
|
def decompose(self, output_spec: Spec, num_inputs: int = 2) -> list[Spec]:
|
||||||
"""Decompose scalar into input scalars for multiplication with type promotion."""
|
"""Decompose scalar into input scalars for multiplication with type promotion."""
|
||||||
if not isinstance(output_spec, ScalarSpec):
|
if not isinstance(output_spec, ScalarSpec):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user