CNTK icon indicating copy to clipboard operation
CNTK copied to clipboard

Is it possible to use a (trainable) vector/matrix to set "defaultHiddenActivation" in PastValue or FutureValue ?

Open hspark84 opened this issue 10 years ago • 2 comments

Hi,

I'm trying to code NTM using CNTK.

I'd like to set trainable memory bias as "defaultHiddenActivation" in PastValue function.

Is it possible to use a (trainable) vector/matrix to set "defaultHiddenActivation" in PastValue or FutureValue ?

hspark84 avatar Aug 12 '16 01:08 hspark84

This is not directly available, but with a trick. Is this a global vector you want to train, or does it depend on the sequence?

If it is a global vector, you can do something like this:

# global vector you want to train
gv = Parameter (dim, 1)
# inside recurrence over x(t)
px = PastValue (0, x)
px1 = BS.Boolean.If (BS.Loop.IsFirst (x), gv, px)

What If() does is select from two inputs based on whether a condition variable is 0 (false) or 1 (true).

If it depends on the sequence, it's a little more complex, I will respond when you confirm.

frankseide avatar Aug 12 '16 04:08 frankseide

It is a global vector.

Thank you for sharing your trick. I will try it right now !!

hspark84 avatar Aug 12 '16 06:08 hspark84