class_docstr: A generic polynomial mean function.
class_docstr_tok: ["A","generic","polynomial","mean","function","."]
docstr: Computes integer tuples corresponding to the powers to raise inputs to.
  
  Specifically this returns, in lexicographical order, all tuples where:
  
  * The tuple has length `input_dim`.
  * The values are non-negative integers.
  * The sum of the tuple is no greater than `degree`.
  
  For example::
  
      compute_powers(degree=2, input_dim=3)
  
  returns::
  
      (0, 0, 0)
      (0, 0, 1)
      (0, 0, 2)
      (0, 1, 0)
      (0, 1, 1)
      (0, 2, 0)
      (1, 0, 0)
      (1, 0, 1)
      (1, 1, 0)
      (2, 0, 0)
  
  where a tuple::
  
      (1, 0, 2)
  
  will translate to a the term::
  
      w[i] * (x[0]**1) * (x[1]**0) * (x[2]**2)
docstr_tok: ["Computes","integer","tuples","corresponding","to","the","powers","to","raise","inputs","to",".","Specifically","this","returns",",","in","lexicographical","order",",","all","tuples","where",":","*","The","tuple","has","length","`","input_dim","`",".","*","The","values","are","non-negative","integers",".","*","The","sum","of","the","tuple","is","no","greater","than","`","degree","`",".","For","example",":",":","compute_powers","(","degree=2",",","input_dim=3",")","returns",":",":","(","0",",","0",",","0",")","(","0",",","0",",","1",")","(","0",",","0",",","2",")","(","0",",","1",",","0",")","(","0",",","1",",","1",")","(","0",",","2",",","0",")","(","1",",","0",",","0",")","(","1",",","0",",","1",")","(","1",",","1",",","0",")","(","2",",","0",",","0",")","where","a","tuple",":",":","(","1",",","0",",","2",")","will","translate","to","a","the","term",":",":","w","[","i","]","*","(","x","[","0","]","*","*","1",")","*","(","x","[","1","]","*","*","0",")","*","(","x","[","2","]","*","*","2",")"]
code: def compute_powers(
      degree: int, input_dim: int
  ) -> Sequence[Tuple[int, ...]]:
      """
      Computes integer tuples corresponding to the powers to raise inputs to.
  
      Specifically this returns, in lexicographical order, all tuples where:
  
      * The tuple has length `input_dim`.
      * The values are non-negative integers.
      * The sum of the tuple is no greater than `degree`.
  
      For example::
  
          compute_powers(degree=2, input_dim=3)
  
      returns::
  
          (0, 0, 0)
          (0, 0, 1)
          (0, 0, 2)
          (0, 1, 0)
          (0, 1, 1)
          (0, 2, 0)
          (1, 0, 0)
          (1, 0, 1)
          (1, 1, 0)
          (2, 0, 0)
  
      where a tuple::
  
          (1, 0, 2)
  
      will translate to a the term::
  
          w[i] * (x[0]**1) * (x[1]**0) * (x[2]**2)
      """
      if not input_dim:
          return [()]
      result = []
      for i in range(degree + 1):
          for inner in Polynomial.compute_powers(
              degree - i, input_dim - 1
          ):
              result.append((i,) + inner)
      return result
  
imports: from typing import Collection, Optional, Sequence, Tuple
  import numpy
  import tensorflow
  from check_shapes import check_shape
  from check_shapes import check_shapes, inherit_check_shapes
  from .base import Module, Parameter, TensorType
  from .config import default_float, default_int
label_desc: Use image node_id 2 for calling the Polynomial obj's underlying member method code with example usage: obj.compute_powers(degree, input_dim) and returns: result, list