parameters: (self, uses: Set["DimDef"])
docstring: Collects all DimDefs reachable through this expression.
docstring_summary: Collects all DimDefs reachable through this expression.
docstring_tokens: Collects all DimDefs reachable through this expression .
function: def collect_dim_uses(self, uses: Set["DimDef"]):
      """Collects all DimDefs reachable through this expression."""
      results = set()
  
      def visit_dim_def(dim_def):
        if isinstance(dim_def, DimDef):
          uses.add(dim_def)
  
      def visit_affine_exprs(expr):
        if isinstance(expr, TensorUse):
          for ind in expr.indices:
            ind.visit_affine_exprs(visit_dim_def)
        if isinstance(expr, TensorReduceFn):
          for ind in expr.reduce_fn.reduce_dims:
            ind.visit_affine_exprs(visit_dim_def)
  
      self.visit_tensor_exprs(visit_affine_exprs)
function_tokens: def collect_dim_uses ( self , uses : Set [ "DimDef" ] ) : results = set ( ) def visit_dim_def ( dim_def ) : if isinstance ( dim_def , DimDef ) : uses . add ( dim_def ) def visit_affine_exprs ( expr ) : if isinstance ( expr , TensorUse ) : for ind in expr . indices : ind . visit_affine_exprs ( visit_dim_def ) if isinstance ( expr , TensorReduceFn ) : for ind in expr . reduce_fn . reduce_dims : ind . visit_affine_exprs ( visit_dim_def ) self . visit_tensor_exprs ( visit_affine_exprs )