class_docstr: A weakly typed Tensor.
  
  A simple wrapper class that contains a normal Tensor.
  
  A "weak" type means that its dtype is temporarily inferred by the system,
  and could defer to other dtypes.
  
  i.g. weak f64 + f16 => f16
  
  This information is used for auto dtype conversion.
class_docstr_tok: ["A","weakly","typed","Tensor",".","A","simple","wrapper","class","that","contains","a","normal","Tensor",".","A","``","weak","''","type","means","that","its","dtype","is","temporarily","inferred","by","the","system",",","and","could","defer","to","other","dtypes",".","i.g",".","weak","f64","+","f16","=",">","f16","This","information","is","used","for","auto","dtype","conversion","."]
docstr: Converts a 'tf.Tensor' into a 'WeakTensor'.
  
  This should be the standard way of creating a WeakTensor instead
  of directly calling the WeakTensor constructor.
  
  Args:
    tensor: The `tf.Tensor` that should be converted into a 'WeakTensor'.
  
  Returns:
    A `EagerWeakTensor` or 'GraphWeakTensor' that holds the `tensor`.
docstr_tok: ["Converts","a","'tf.Tensor","'","into","a","'WeakTensor","'",".","This","should","be","the","standard","way","of","creating","a","WeakTensor","instead","of","directly","calling","the","WeakTensor","constructor",".","Args",":","tensor",":","The","`","tf.Tensor","`","that","should","be","converted","into","a","'WeakTensor","'",".","Returns",":","A","`","EagerWeakTensor","`","or","'GraphWeakTensor","'","that","holds","the","`","tensor","`","."]
code: def from_tensor(cls, tensor):
      """Converts a 'tf.Tensor' into a 'WeakTensor'.
  
      This should be the standard way of creating a WeakTensor instead
      of directly calling the WeakTensor constructor.
  
      Args:
        tensor: The `tf.Tensor` that should be converted into a 'WeakTensor'.
  
      Returns:
        A `EagerWeakTensor` or 'GraphWeakTensor' that holds the `tensor`.
      """
      if isinstance(tensor, core.Value):
          return EagerWeakTensor(tensor)
      if isinstance(tensor, core.Symbol):
          return GraphWeakTensor(tensor)
      raise errors.InvalidArgumentError(
          None,
          None,
          "WeakTensor can only be constructed from tf.Tensor or tf.WeakTensor,"
          f" but {type(tensor)} was given.",
      )
  
imports: from typing import Optional
  import numpy
  from tensorflow.python.eager import context
  from tensorflow.python.framework import composite_tensor_gradient
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import extension_type
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor
  from tensorflow.python.framework import tensor_conversion_registry
  from tensorflow.python.types import core
label_desc: Use image node_id 18 for calling the WeakTensor obj's underlying member method code with example usage: obj.from_tensor(cls, tensor) and returns: EagerWeakTensor, GraphWeakTensor