class_docstr: Affine warp constraints class.
  
  `AffineWarpConstraints` allow for
  very succinct definitions of constraints on
  the values of entries in affine transform matrices.
docstr: Creates a constraint definition for an affine transformation.
  
  Args:
    constraints: A doubly-nested iterable of shape `[N, N+1]`
    defining constraints on the entries of a matrix that
    represents an affine transformation in `N` dimensions.
    A numeric value bakes in a constraint on the corresponding
    entry in the transformation matrix, whereas `None` implies that
    the corresponding entry will be specified at run time.
  
  Raises:
    TypeError: If `constraints` is not a nested iterable.
    ValueError: If the double iterable `constraints` has inconsistent
      dimensions.
docstr_tok: ["Creates","a","constraint","definition","for","an","affine","transformation",".","Args",":","constraints",":","A","doubly-nested","iterable","of","shape","`","[","N",",","N+1","]","`","defining","constraints","on","the","entries","of","a","matrix","that","represents","an","affine","transformation","in","`","N","`","dimensions",".","A","numeric","value","bakes","in","a","constraint","on","the","corresponding","entry","in","the","transformation","matrix",",","whereas","`","None","`","implies","that","the","corresponding","entry","will","be","specified","at","run","time",".","Raises",":","TypeError",":","If","`","constraints","`","is","not","a","nested","iterable",".","ValueError",":","If","the","double","iterable","`","constraints","`","has","inconsistent","dimensions","."]
code: def __init__(self, constraints=((None,) * 3,) * 2):
      """Creates a constraint definition for an affine transformation.
  
      Args:
        constraints: A doubly-nested iterable of shape `[N, N+1]`
        defining constraints on the entries of a matrix that
        represents an affine transformation in `N` dimensions.
        A numeric value bakes in a constraint on the corresponding
        entry in the transformation matrix, whereas `None` implies that
        the corresponding entry will be specified at run time.
  
      Raises:
        TypeError: If `constraints` is not a nested iterable.
        ValueError: If the double iterable `constraints` has inconsistent
          dimensions.
      """
      try:
          self._constraints = tuple(tuple(x) for x in constraints)
      except TypeError:
          tf.logging.fatal("constraints must be a nested iterable.")
          raise TypeError
  
      # Number of rows
      self._num_dim = len(self._constraints)
      expected_num_cols = self._num_dim + 1
      if any(len(x) != expected_num_cols for x in self._constraints):
          tf.logging.fatal(
              "The input list must define a Nx(N+1) matrix of constraints."
          )
          raise ValueError
  
imports: from __future__ import absolute_import, division, print_function
  from itertools import chain
  import numpy
  import tensorflow
  from niftynet.layer.base_layer import Layer, LayerFromCallable, Invertible
label_desc: Use image node_id 1 to create a new AffineWarpConstraints object from inherited base classes: object with example: obj = AffineWarpConstraints(constraints)