Class: Gsplat::Autograd::GraphNode

Inherits:
Object
  • Object
show all
Defined in:
lib/gsplat/autograd/function.rb

Overview

A recorded invocation shared by all outputs of one Function.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(function, context, inputs) ⇒ GraphNode

Returns a new instance of GraphNode.



10
11
12
13
14
15
# File 'lib/gsplat/autograd/function.rb', line 10

def initialize(function, context, inputs)
  @function = function
  @context = context
  @inputs = inputs
  @outputs = []
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



7
8
9
# File 'lib/gsplat/autograd/function.rb', line 7

def context
  @context
end

#functionObject (readonly)

Returns the value of attribute function.



7
8
9
# File 'lib/gsplat/autograd/function.rb', line 7

def function
  @function
end

#inputsObject (readonly)

Returns the value of attribute inputs.



7
8
9
# File 'lib/gsplat/autograd/function.rb', line 7

def inputs
  @inputs
end

#outputsObject

Returns the value of attribute outputs.



8
9
10
# File 'lib/gsplat/autograd/function.rb', line 8

def outputs
  @outputs
end

Instance Method Details

#backward(*grad_outputs) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Delegates output gradients to the operation's backward method.



19
20
21
# File 'lib/gsplat/autograd/function.rb', line 19

def backward(*grad_outputs)
  function.backward(context, *grad_outputs)
end

#releaseObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Releases graph references after a backward traversal.



25
26
27
28
29
30
# File 'lib/gsplat/autograd/function.rb', line 25

def release
  outputs.each { |output| output.clear_creator(self) }
  context.clear
  @inputs = []
  @outputs = []
end