Check if cx is None
@@ -593,6 +593,7 @@ def rnn_forward_inference(
core.ndarray hx, core.ndarray cx, core.ndarray w, core.ndarray xs,
lengths):
hx = core.ascontiguousarray(hx)
+ if cx is not None:
cx = core.ascontiguousarray(cx)
w = core.ascontiguousarray(w)
xs = core.ascontiguousarray(xs)
@@ -657,6 +658,7 @@ def rnn_forward_training(
core.ndarray hx, core.ndarray cx, core.ndarray w, core.ndarray xs,
lengths):
hx = core.ascontiguousarray(hx)
+ if cx is not None:
cx = core.ascontiguousarray(cx)
w = core.ascontiguousarray(w)
xs = core.ascontiguousarray(xs)
@@ -728,11 +730,13 @@ def rnn_backward_data(
core.ndarray dhy, core.ndarray dcy, core.ndarray dys,
lengths):
hx = core.ascontiguousarray(hx)
+ if cx is not None:
cx = core.ascontiguousarray(cx)
w = core.ascontiguousarray(w)
xs = core.ascontiguousarray(xs)
ys = core.ascontiguousarray(ys)
dhy = core.ascontiguousarray(dhy)
+ if dcy is not None:
dcy = core.ascontiguousarray(dcy)
dys = core.ascontiguousarray(dys)
