I think this should work:
beta = T.eq(target, 0.).sum()/target.size.astype(theano.config.floatX)

On Wednesday, July 27, 2016 at 6:16:02 AM UTC-7, Feng Gu wrote:
>
> I'm quite new to Theano and trying to implement a modified version of "
> theano.tensor.nnet.binary_crossentropy()" that is multiplied by a scalar 
> as "loss = -(beta * (target * T.log(output)) + (1.0 - beta) * ((1.0 - 
> target) * T.log(1.0 - output)))". "beta" is equal to the number of zero 
> elements in "target" divided by the total number of elements. "target" and 
> "output" are both "T.tensor4('targets', dtype=theano.config.floatX)".
>
> Can someone please tell me how to compute "beta" in Theano? Many thanks in 
> advance.
>
> Feng
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"theano-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to