Module: Gsplat::Ops::TensorOps

Defined in:
lib/gsplat/ops/tensor_shape_ops.rb

Overview

Internal helpers for composing coarse differentiable operations.

Class Method Summary collapse

Class Method Details

.apply(function, *inputs) ⇒ Object



9
10
11
12
13
14
# File 'lib/gsplat/ops/tensor_shape_ops.rb', line 9

def apply(function, *inputs, **)
  return function.apply(*inputs, **) if inputs.any?(Autograd::Variable)

  needs_grad = Array.new(inputs.length, false)
  function.forward(Autograd::Context.new(needs_grad), *inputs, **)
end

.data(value) ⇒ Object



16
17
18
# File 'lib/gsplat/ops/tensor_shape_ops.rb', line 16

def data(value)
  value.is_a?(Autograd::Variable) ? value.data : value
end