Class: Tensorflow::OpSpec
- Inherits:
-
Object
- Object
- Tensorflow::OpSpec
- Defined in:
- lib/tensorflow/opspec.rb
Overview
OpSpec is the specification of an Operation to be added to a Graph (using Graph AddOperation).
Instance Attribute Summary collapse
-
#attr ⇒ Object
Name by which the added operation will be referred to in the Graph.
-
#input ⇒ Object
Name by which the added operation will be referred to in the Graph.
-
#inputlist ⇒ Object
Returns the value of attribute inputlist.
-
#name ⇒ Object
Name by which the added operation will be referred to in the Graph.
-
#type ⇒ Object
Type of the operation (e.g., “Add”, “MatMul”).
Instance Method Summary collapse
-
#initialize(name = nil, type = nil, attribute = nil, input = nil, inputlist = nil) ⇒ OpSpec
constructor
Name by which the added operation will be referred to in the Graph.
Constructor Details
#initialize(name = nil, type = nil, attribute = nil, input = nil, inputlist = nil) ⇒ OpSpec
Name by which the added operation will be referred to in the Graph. If omitted, defaults to Type. Inputs to this operation, which in turn must be outputs of other operations already added to the Graph.
An operation may have multiple inputs with individual inputs being either a single tensor produced by another operation or a list of tensors produced by multiple operations. For example, the “Concat” operation takes two inputs: (1) the dimension along which to concatenate and (2) a list of tensors to concatenate. Thus, for Concat, len(Input) must be 2, with the first element being an Output and the second being an OutputList. Map from attribute name to its value that will be attached to this operation. Other possible fields: Device, ColocateWith, ControlInputs.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/tensorflow/opspec.rb', line 25 def initialize(name = nil, type = nil, attribute = nil, input = nil, inputlist = nil) self.name = name self.type = type self.attr = if attribute.nil? {} else attribute end self.input = if input.nil? [] else input end self.inputlist = if inputlist.nil? [] else inputlist end raise 'The operation specification is either input or inputlist but not both.' if !input.nil? && !inputlist.nil? end |
Instance Attribute Details
#attr ⇒ Object
Name by which the added operation will be referred to in the Graph. If omitted, defaults to Type. Inputs to this operation, which in turn must be outputs of other operations already added to the Graph.
An operation may have multiple inputs with individual inputs being either a single tensor produced by another operation or a list of tensors produced by multiple operations. For example, the “Concat” operation takes two inputs: (1) the dimension along which to concatenate and (2) a list of tensors to concatenate. Thus, for Concat, len(Input) must be 2, with the first element being an Output and the second being an OutputList. Map from attribute name to its value that will be attached to this operation. Other possible fields: Device, ColocateWith, ControlInputs.
25 26 27 |
# File 'lib/tensorflow/opspec.rb', line 25 def attr @attr end |
#input ⇒ Object
Name by which the added operation will be referred to in the Graph. If omitted, defaults to Type. Inputs to this operation, which in turn must be outputs of other operations already added to the Graph.
An operation may have multiple inputs with individual inputs being either a single tensor produced by another operation or a list of tensors produced by multiple operations. For example, the “Concat” operation takes two inputs: (1) the dimension along which to concatenate and (2) a list of tensors to concatenate. Thus, for Concat, len(Input) must be 2, with the first element being an Output and the second being an OutputList. Map from attribute name to its value that will be attached to this operation. Other possible fields: Device, ColocateWith, ControlInputs.
25 26 27 |
# File 'lib/tensorflow/opspec.rb', line 25 def input @input end |
#inputlist ⇒ Object
Returns the value of attribute inputlist.
4 5 6 |
# File 'lib/tensorflow/opspec.rb', line 4 def inputlist @inputlist end |
#name ⇒ Object
Name by which the added operation will be referred to in the Graph. If omitted, defaults to Type. Inputs to this operation, which in turn must be outputs of other operations already added to the Graph.
An operation may have multiple inputs with individual inputs being either a single tensor produced by another operation or a list of tensors produced by multiple operations. For example, the “Concat” operation takes two inputs: (1) the dimension along which to concatenate and (2) a list of tensors to concatenate. Thus, for Concat, len(Input) must be 2, with the first element being an Output and the second being an OutputList. Map from attribute name to its value that will be attached to this operation. Other possible fields: Device, ColocateWith, ControlInputs.
25 26 27 |
# File 'lib/tensorflow/opspec.rb', line 25 def name @name end |
#type ⇒ Object
Type of the operation (e.g., “Add”, “MatMul”).
25 26 27 |
# File 'lib/tensorflow/opspec.rb', line 25 def type @type end |