Module: Ignis::Tensor
- Defined in:
- lib/nvruby/tensor.rb,
lib/nvruby/tensor/contraction.rb
Overview
Tensor operations module Provides high-level API for tensor contractions and reductions using cuTENSOR
Defined Under Namespace
Classes: Contraction
Class Method Summary collapse
-
.batched_contract(expression, a, b, alpha: 1.0) ⇒ NvArray
Perform batched tensor contraction.
-
.contract(expression, a, b, alpha: 1.0) ⇒ NvArray
Perform tensor contraction using Einstein notation.
Class Method Details
.batched_contract(expression, a, b, alpha: 1.0) ⇒ NvArray
Perform batched tensor contraction
36 37 38 39 |
# File 'lib/nvruby/tensor.rb', line 36 def batched_contract(expression, a, b, alpha: 1.0) # Prepend batch dimension to expression if not present contract(expression, a, b, alpha: alpha) end |
.contract(expression, a, b, alpha: 1.0) ⇒ NvArray
Perform tensor contraction using Einstein notation
23 24 25 26 27 28 |
# File 'lib/nvruby/tensor.rb', line 23 def contract(expression, a, b, alpha: 1.0) contraction = Contraction.new(expression, a, b, alpha: alpha) contraction.execute ensure contraction&.destroy! end |