Method: TensorStream::Train::SlotCreator#create_slot

Defined in:
lib/tensor_stream/train/slot_creator.rb

#create_slot(primary, val, name, colocate_with_primary: true) ⇒ Object

Create a slot initialized to the given value

Args:

primary: Variable - The primary 'Variable' or 'Tensor'
val: Tensor - A `Tensor` specifying the initial value of the slot
name: String - Name to use for the slot variable
colocate_with_primary: Boolean - If true the slot is located
                                 on the same device as `primary`

Returns: A ‘Variable` object



25
26
27
28
29
30
31
32
33
# File 'lib/tensor_stream/train/slot_creator.rb', line 25

def create_slot(primary, val, name, colocate_with_primary: true)
  TensorStream.variable_scope(nil, primary.op.name + "/" + name) do
    return create_slot_var(primary, val, "", nil) if colocate_with_primary

    TensorStream.colocate_with(primary) do
      return create_slot_var(primary, val, "", nil)
    end
  end
end