You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/03/15 07:31:07 UTC
[GitHub] Sherry-Zhang commented on a change in pull request #10104: [WIP][MXNET-107] Fused RNN implementation for CPU
Sherry-Zhang commented on a change in pull request #10104: [WIP][MXNET-107] Fused RNN implementation for CPU
URL: https://github.com/apache/incubator-mxnet/pull/10104#discussion_r174695590
##########
File path: tests/python/unittest/test_operator.py
##########
@@ -27,6 +27,83 @@
from common import setup_module, with_seed
import unittest
+def check_lstm_with_type(xpu, type1, type2, atol):
+ X = mx.sym.Variable('x')
+ Params = mx.sym.Variable('params')
+ HX = mx.sym.Variable('state')
+ CX = mx.sym.Variable('state_cell')
+ T, N, I, H, nd, nl = 4, 16, 800, 800, 1, 1
+ size = (I + H + 2) * H * 4 * nd; # first layer
+ x1 = mx.random.uniform(-1, 1, (T, N, I), ctx=xpu, dtype=type1)
+ wx = mx.random.uniform(-1, 1, (4 * H, I), ctx=xpu,dtype=type1)
+ wh = mx.random.uniform(-1, 1, (4 * H, H), ctx=xpu,dtype=type1)
+ bx = mx.nd.zeros((4 * H,), ctx=xpu, dtype=type1)
+ bh = mx.nd.zeros((4 * H,), ctx=xpu, dtype=type1)
+ x1.attach_grad()
Review comment:
attach_grad is used to create gradient buffer for these NDArrays here. Do you mean this can be implemented in other ways or do you have any suggestion about this piece of code?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services