class_docstr: Layer which put asserts on shapes of tensors, and returns them unchanged.
  
  It borrows the notation from assert_shape decorator, except it doesn't have
  the arrow '->' special character, as the input tensors are the same as output.
class_docstr_tok: ["Layer","which","put","asserts","on","shapes","of","tensors",",","and","returns","them","unchanged",".","It","borrows","the","notation","from","assert_shape","decorator",",","except","it","does","n't","have","the","arrow","'-",">","'","special","character",",","as","the","input","tensors","are","the","same","as","output","."]
docstr: Creates AssertShape layer.
  
  Args:
    spec: Specification for input tensors. See assert_shape decorator for the
        full documentation.
    message: An optional message to include when assert fails. By default it
        includes the filename and line number where this function was called.
    visible_layer: If true, print this layer inside the model (default: False)
docstr_tok: ["Creates","AssertShape","layer",".","Args",":","spec",":","Specification","for","input","tensors",".","See","assert_shape","decorator","for","the","full","documentation",".","message",":","An","optional","message","to","include","when","assert","fails",".","By","default","it","includes","the","filename","and","line","number","where","this","function","was","called",".","visible_layer",":","If","true",",","print","this","layer","inside","the","model","(","default",":","False",")"]
code: def __init__(self, spec, message=None, visible_layer=False):
      """Creates AssertShape layer.
  
      Args:
        spec: Specification for input tensors. See assert_shape decorator for the
            full documentation.
        message: An optional message to include when assert fails. By default it
            includes the filename and line number where this function was called.
        visible_layer: If true, print this layer inside the model (default: False)
      """
      name = "AssertShape" if visible_layer else ""
      super().__init__(name=name)
      spec = spec.replace("...", ".")
      for letter in spec:
          assert (
              letter in string.ascii_letters + string.digits + "." + ","
          )
      self._specs = spec.split(",")
      self._n_in = self._n_out = len(self._specs)
  
      self._defined_shapes = {str(i): i for i in range(10)}
      self._linked = False
  
      if message is None:
          caller = inspect.getframeinfo(inspect.stack()[1][0])
          self._message = (
              f"Defined at {caller.filename}:{caller.lineno}"
          )
      else:
          self._message = message
  
file_path: trax/trax/layers/assert_shape.py
imports: import functools
  import inspect
  import string
  from absl import logging
  from trax.layers import base
  from trax.layers import combinators
label_desc: Use image node_id 1 to create a new AssertShape object from inherited base classes: base with example: obj = AssertShape(spec, message, visible_layer)