Closed embeddetech closed 8 years ago
Yes, it is deprecated; yes, it is a record declaration.
However, many functions also create a record and either return the entire record, or select one element to return (this in a way of using local variables).
Thank you Frank! So from the example above, this is the definition of a function that returns a record:
model (features) = {...}
Then inside that, this line below calls the LinearLayer function with arguments in the braces, and that function returns a function pointer/lambda which is then immediately called with (featNorm) as its argument, and this result is assigned to h1?
h1 = LinearLayer {100, init="gaussian", initValueScale=1.5} (featNorm)
Think I'm slowly getting there... thanks for helping the slow kids in class...
Typically, it is
model (features) = { a = ... ; b = ...; z = ... }.z
which technically creates a record but then immediately pulls out z
. You can think of a
and b
etc as variables in a local scope.
h1 = LinearLayer {100, init="gaussian", initValueScale=1.5} (featNorm)
Here, the curly braces mean something entirely different--function calls can use ( ) or { }, and by convention, functions that create model parameters use { }. The above is actually two function calls:
LinearLayer{...}
is a function that creates a function object with baked in learnable model parameters. This function object is returned as a callable function.h1 = ... (featNorm)
then invokes that callable function immediately.This separation was done so that it is always clear where new parameters are created. It also has additional benefits:
Sequential()
function to form neural networks as concatenations of layers.
Hello, I'm currently trying to slowly digest the brainscript syntax. Is it correct that the use of the bracket in the example below (beginning "BrainScriptNetworkBuilder = [") is deprecated, and the use of braces is recommended (i.e. "BrainScriptNetworkBuilder = {")? And the best explanation for this is that "BrainScriptNetworkBuilder = " is a record declaration as opposed to a function/macro declaration?
https://github.com/Microsoft/CNTK/wiki/Train-a-regression-model-on-images