Method: TensorStream::Train::SlotCreator#create_zeros_slot
- Defined in:
- lib/tensor_stream/train/slot_creator.rb
#create_zeros_slot(primary, name, dtype: nil, colocate_with_primary: true) ⇒ Object
Create a slot initialized to 0 with same shape as the primary object.
Args:
primary: The pirmary variable or Tensor
name: String - Name to use for the slot variable
dtype: Symbol - Type of the slot variable
colocate_with_primary: boolean - If true the slot is located on the same device as primary
Returns:
A `Variable` object
53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/tensor_stream/train/slot_creator.rb', line 53 def create_zeros_slot(primary, name, dtype: nil, colocate_with_primary: true) dtype = primary.data_type if dtype.nil? slot_shape = primary.shape slot_shape = if slot_shape.fully_defined? slot_shape.shape else TensorStream.shape(primary.initialized_value) end val = TensorStream.zeros(slot_shape, dtype: dtype) create_slot(primary, val, name, colocate_with_primary: colocate_with_primary) end |