constant

dragon.constant(
  value,
  dtype=None,
  shape=None,
  name=None
)[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.
Returns:

dragon.Tensor – The output tensor.