Input

dragon.vm.tensorlayer.layers.Input(
  shape,
  dtype='float32',
  name=None
)[source]

Create a placeholder as input.

The placeholder is an eager tensor filled with ones:

x = tl.layers.Input(shape=(2, 3))
print(x)

You can map the memory of a constant value to it:

value = [1, 2]
x.set_value(value)
x += 1
print(x, value)  # x != value, python list could not be mapped

value = np.array([1, 2])
x.set_value(value)
x += 1
print(x, value)  # x == value, memory is zero-copied
Parameters:
  • shape (Sequence[int]) – The tensor shape to initialize values.
  • dtype (str, optional, default='float32') – The optional data type.
  • name (str, optional) – A optional name for the operation.
Returns:

dragon.Tensor – The placeholder tensor.