Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function get_pdf(s) {
var h = s[0];
var NOUT = N_mixture;
var z = nj.add(nj.dot(h, dec_output_w), dec_output_b);
var z_pen_logits = z.slice([0, 3]);
var z_pi = z.slice([3 + NOUT * 0, 3 + NOUT * 1]);
var z_mu1 = z.slice([3 + NOUT * 1, 3 + NOUT * 2]);
var z_mu2 = z.slice([3 + NOUT * 2, 3 + NOUT * 3]);
var z_sigma1 = nj.exp(z.slice([3 + NOUT * 3, 3 + NOUT * 4]));
var z_sigma2 = nj.exp(z.slice([3 + NOUT * 4, 3 + NOUT * 5]));
var z_corr = nj.tanh(z.slice([3 + NOUT * 5, 3 + NOUT * 6]));
z_pen_logits = nj.subtract(z_pen_logits, z_pen_logits.max());
var z_pen = nj.softmax(z_pen_logits);
z_pi = nj.subtract(z_pi, z_pi.max());
z_pi = nj.softmax(z_pi);
return [z_pi, z_mu1, z_mu2, z_sigma1, z_sigma2, z_corr, z_pen];
};
function get_pdf(s) {
var h = s[0];
var NOUT = N_mixture;
var z = nj.add(nj.dot(h, dec_output_w), dec_output_b);
var z_pen_logits = z.slice([0, 3]);
var z_pi = z.slice([3 + NOUT * 0, 3 + NOUT * 1]);
var z_mu1 = z.slice([3 + NOUT * 1, 3 + NOUT * 2]);
var z_mu2 = z.slice([3 + NOUT * 2, 3 + NOUT * 3]);
var z_sigma1 = nj.exp(z.slice([3 + NOUT * 3, 3 + NOUT * 4]));
var z_sigma2 = nj.exp(z.slice([3 + NOUT * 4, 3 + NOUT * 5]));
var z_corr = nj.tanh(z.slice([3 + NOUT * 5, 3 + NOUT * 6]));
z_pen_logits = nj.subtract(z_pen_logits, z_pen_logits.max());
var z_pen = nj.softmax(z_pen_logits);
z_pi = nj.subtract(z_pi, z_pi.max());
z_pi = nj.softmax(z_pi);
return [z_pi, z_mu1, z_mu2, z_sigma1, z_sigma2, z_corr, z_pen];
};