You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was investigating and adding a test case to this issue #5325 and came upon this internal crash
# Error: internal error: (filename: ccgstmts.nim, line: 1126)
# No stack traceback available
# To create a stacktrace, rerun compilation with ./koch temp c <file>
Test case
typeGate[TT] =refobject {.inheritable.}
# Base operator or layer# Inherit from it and add a forward and backward method.Node[TT] =refNodeObj[TT]
NodeObj {.acyclic.} [TT] =object# Store an operator/layer + its parent
gate: Gate[TT]
parents: array[2, Node[TT]]
Context*[TT] =refobject## Tape / Wengert list. Contains the list of applied operations or layers## i.e. Directed Acyclic Graph
nodes: seq[Node[TT]]
Variable*[TT] =object## Wrapper for values
tape: Context[TT]
value: TT# TT should be a Tensor[T] or CudaTensor[T] or a scalarmethodbackward*[TT](self: Gate[TT], gradient: TT): array[2,TT] {.base.} =raisenewException(ValueError, "backward method is not implemented")
methodforward*[TT](self: Gate[TT], a, b: Variable[TT]): Variable[TT] {.base.} =raisenewException(ValueError, "forward method is not implemented")
procnewContext*(TT: typedesc): Context[TT] {.noSideEffect.} =## Initialize a context (Tape / Wengert list)newresultresult.nodes =newSeq[Node[TT]]()
#############################################################typeAddGate {.final.} [TT] =refobjectofGate[TT]
arity: int
a_shape: seq[int]
b_shape: seq[int]
methodforward*[TT](self: AddGate[TT], a, b: Variable[TT]): Variable[TT] =returnVariable[TT](tape: a.tape, value: a.value + b.value)
methodbackward*[TT](self: AddGate[TT], gradient: TT): array[2,TT] =result#<--- crash# Error: internal error: (filename: ccgstmts.nim, line: 1126)# No stack traceback available# To create a stacktrace, rerun compilation with ./koch temp c <file># Using the next statements instead do not crash# result[0] = 1.TT# result[1] = 1.TTvar ctx =newContextfloat32
The text was updated successfully, but these errors were encountered:
I was investigating and adding a test case to this issue #5325 and came upon this internal crash
Test case
The text was updated successfully, but these errors were encountered: