-
Notifications
You must be signed in to change notification settings - Fork 950
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why the bcast
is needed in create_param()
?
#912
Comments
It is there to work around the fact that Theano broadcastable isn't
perfect. In fact, in some case, it is not possible to do it without user
help, but in other case, Theano could be improved too, but those case are
complicated.
…On Thu, Aug 2, 2018 at 2:21 AM David Leon ***@***.***> wrote:
In create_param()
<https://github.com/Lasagne/Lasagne/blob/a61b76fd991f84c50acdb7bea02118899b5fefe1/lasagne/utils.py#L392>,
these two lines confuse me:
bcast = tuple(s == 1 for s in shape)
spec = theano.shared(spec, broadcastable=bcast)
I'm wondering what the bcast is for, especially these two lines will
cause theano exception TypeError: Cannot convert Type TensorType(float32,
vector) (of Variable Elemwise{add,no_inplace}.0) into Type
TensorType(float32, (True,)) when shape arg is set to [1]
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#912>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AALC-yjdjrg4-WumTsZWzoF6xVfASuOCks5uMpptgaJpZM4VrspB>
.
|
Sorry for the late reply. Lasagne has partial information on the input shapes and full information on the parameter shapes, and it uses this to set the correct broadcast patterns on Theano variables (which do not have any shape information at all). This allows some expressions using the outputs of Lasagne networks to work out of the box that would fail otherwise (see #715 for why this was introduced in the first place). On the downside, it requires extra care about broadcast patterns in user-provided variables. |
In
create_param()
, these two lines confuse me:I'm wondering what the
bcast
is for, especially these two lines will cause theano exceptionTypeError: Cannot convert Type TensorType(float32, vector) (of Variable Elemwise{add,no_inplace}.0) into Type TensorType(float32, (True,))
whenshape
arg is set to[1]
The text was updated successfully, but these errors were encountered: