Class: TensorStream::TensorShape
- Inherits:
-
Object
- Object
- TensorStream::TensorShape
- Defined in:
- lib/tensor_stream/tensor_shape.rb
Instance Attribute Summary collapse
-
#rank ⇒ Object
Returns the value of attribute rank.
-
#shape ⇒ Object
Returns the value of attribute shape.
Instance Method Summary collapse
- #[](index) ⇒ Object
-
#initialize(shape, rank) ⇒ TensorShape
constructor
A new instance of TensorShape.
- #ndims ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(shape, rank) ⇒ TensorShape
Returns a new instance of TensorShape.
5 6 7 8 |
# File 'lib/tensor_stream/tensor_shape.rb', line 5 def initialize(shape, rank) @shape = shape @rank = rank end |
Instance Attribute Details
#rank ⇒ Object
Returns the value of attribute rank.
3 4 5 |
# File 'lib/tensor_stream/tensor_shape.rb', line 3 def rank @rank end |
#shape ⇒ Object
Returns the value of attribute shape.
3 4 5 |
# File 'lib/tensor_stream/tensor_shape.rb', line 3 def shape @shape end |
Instance Method Details
#[](index) ⇒ Object
17 18 19 |
# File 'lib/tensor_stream/tensor_shape.rb', line 17 def [](index) @shape[index] end |
#ndims ⇒ Object
21 22 23 |
# File 'lib/tensor_stream/tensor_shape.rb', line 21 def ndims shape.size end |
#to_s ⇒ Object
10 11 12 13 14 15 |
# File 'lib/tensor_stream/tensor_shape.rb', line 10 def to_s dimensions = @shape.collect do |r| "Dimension(#{r})" end.join(',') "TensorShape([#{dimensions}])" end |