Module: TensorFlow::Ops
- Included in:
- TensorFlow
- Defined in:
- lib/tensorflow/ops.rb
Instance Method Summary collapse
- #cast(x, dtype) ⇒ Object
- #expand_dims(input, axis) ⇒ Object
- #fill(dims, value) ⇒ Object
- #identity(input) ⇒ Object
- #ones(dims) ⇒ Object
- #range(start, limit = nil, delta = 1) ⇒ Object
- #reshape(tensor, shape) ⇒ Object
- #squeeze(input, axis: nil) ⇒ Object
- #timestamp ⇒ Object
- #transpose(x, perm: [1, 0]) ⇒ Object
- #zeros(dims) ⇒ Object
- #zeros_like(x) ⇒ Object
Instance Method Details
#cast(x, dtype) ⇒ Object
4 5 6 |
# File 'lib/tensorflow/ops.rb', line 4 def cast(x, dtype) Utils.execute("Cast", [x], DstT: FFI::DataType[dtype]) end |
#expand_dims(input, axis) ⇒ Object
8 9 10 |
# File 'lib/tensorflow/ops.rb', line 8 def (input, axis) RawOps.(input: input, dim: axis) end |
#fill(dims, value) ⇒ Object
12 13 14 |
# File 'lib/tensorflow/ops.rb', line 12 def fill(dims, value) RawOps.fill(dims: dims, value: value) end |
#identity(input) ⇒ Object
16 17 18 |
# File 'lib/tensorflow/ops.rb', line 16 def identity(input) RawOps.identity(input: input) end |
#ones(dims) ⇒ Object
20 21 22 |
# File 'lib/tensorflow/ops.rb', line 20 def ones(dims) fill(dims, 1) end |
#range(start, limit = nil, delta = 1) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/tensorflow/ops.rb', line 24 def range(start, limit = nil, delta = 1) unless limit limit = start start = 0 end RawOps.range(start: start, limit: limit, delta: delta) end |
#reshape(tensor, shape) ⇒ Object
32 33 34 |
# File 'lib/tensorflow/ops.rb', line 32 def reshape(tensor, shape) RawOps.reshape(tensor: tensor, shape: shape) end |
#squeeze(input, axis: nil) ⇒ Object
36 37 38 |
# File 'lib/tensorflow/ops.rb', line 36 def squeeze(input, axis: nil) RawOps.squeeze(input: input, squeeze_dims: axis) end |
#timestamp ⇒ Object
40 41 42 |
# File 'lib/tensorflow/ops.rb', line 40 def RawOps. end |
#transpose(x, perm: [1, 0]) ⇒ Object
44 45 46 |
# File 'lib/tensorflow/ops.rb', line 44 def transpose(x, perm: [1, 0]) RawOps.transpose(x: x, perm: perm) end |
#zeros(dims) ⇒ Object
48 49 50 |
# File 'lib/tensorflow/ops.rb', line 48 def zeros(dims) fill(dims, 0) end |
#zeros_like(x) ⇒ Object
52 53 54 |
# File 'lib/tensorflow/ops.rb', line 52 def zeros_like(x) RawOps.zeros_like(x: x) end |