constant

dragon.constant(
  value,
  dtype=None,
  shape=None,
  name=None,
  copy=True,
  symbolic=False
)[source]

Return a tensor initialized from the value.

Examples:

a = dragon.constant(1)
b = dragon.constant(1, dtype='float32', shape=(1, 1, 1))
c = dragon.constant(numpy.ones((2, 3))
Parameters:
  • value (array_like) – The value to initialize from.
  • dtype (str, optional) – The optional data type.
  • shape (Sequence[int], optional) – The optional tensor shape.
  • name (str, optional) – The optional tensor name.
  • copy (bool, optional, default=True) – Whether to copy the value.
  • symbolic (bool, optional, default=False) – Whether to initialize as a symbolic tensor.
Returns:

dragon.Tensor – The output tensor.