def _args_to_avals_and_env(args: Sequence[TfVal], polymorphic_shapes: Sequence[Optional[Union[(str, PolyShape)]]]) -> Tuple[(Sequence[core.AbstractValue], _ShapeEnv)]:
    'Computes abstract values and a dimension environment for arguments.\n\n  Args:\n    args: the arguments, TF inputs.\n    polymorphic_shapes: the polymorphic specifications for the arguments.\n  Returns: a tuple of a sequence of abtract values corresponding to the\n    arguments and a dimension environment.\n  '
    shapeenv: _ShapeEnv = {}

    def input_aval(arg: TfVal, polymorphic_shape: Optional[str]) -> core.AbstractValue:
        'The abstract value for an input.'
        (raw_shape, dtype) = _tfval_shape_dtype(arg)
        aval_shape = shape_poly.parse_spec(polymorphic_shape, raw_shape)
        for (i, d) in enumerate(aval_shape):
            if (type(d) is int):
                assert (d == np.shape(arg)[i])
            elif ((type(d) is shape_poly.DimVar) and (d not in shapeenv)):
                shapeenv[d] = tf.shape(arg)[i]
            else:
                pass
        return core.ShapedArray(aval_shape, dtype)
    avals = tuple(map(input_aval, args, polymorphic_shapes))
    return (avals, shapeenv)
Computes abstract values and a dimension environment for arguments.

Args:
  args: the arguments, TF inputs.
  polymorphic_shapes: the polymorphic specifications for the arguments.
Returns: a tuple of a sequence of abtract values corresponding to the
  arguments and a dimension environment.
def _args_to_avals_and_env(args: Sequence[TfVal], polymorphic_shapes: Sequence[Optional[Union[(str, PolyShape)]]]) -> Tuple[(Sequence[core.AbstractValue], _ShapeEnv)]:
    'Computes abstract values and a dimension environment for arguments.\n\n  Args:\n    args: the arguments, TF inputs.\n    polymorphic_shapes: the polymorphic specifications for the arguments.\n  Returns: a tuple of a sequence of abtract values corresponding to the\n    arguments and a dimension environment.\n  '
    shapeenv: _ShapeEnv = {}

    def input_aval(arg: TfVal, polymorphic_shape: Optional[str]) -> core.AbstractValue:
        'The abstract value for an input.'
        (raw_shape, dtype) = _tfval_shape_dtype(arg)
        aval_shape = shape_poly.parse_spec(polymorphic_shape, raw_shape)
        for (i, d) in enumerate(aval_shape):
            if (type(d) is int):
                assert (d == np.shape(arg)[i])
            elif ((type(d) is shape_poly.DimVar) and (d not in shapeenv)):
                shapeenv[d] = tf.shape(arg)[i]
            else:
                pass
        return core.ShapedArray(aval_shape, dtype)
    avals = tuple(map(input_aval, args, polymorphic_shapes))
    return (avals, shapeenv)