<commit_before>package BIDMach.updaters
 
import BIDMat.{Mat,SBMat,CMat,DMat,FMat,IMat,HMat,GMat,GIMat,GSMat,SMat,SDMat,TMat}
import BIDMat.MatFunctions._
import BIDMat.SciFunctions._
import BIDMach.models._
import edu.berkeley.bid.CUMACH
import edu.berkeley.bid.CPUMACH
import jcuda.runtime.JCuda._
import scala.concurrent.Future
import scala.concurrent.ExecutionContext.Implicits.global

class ADAGrad(override val opts:ADAGrad.Opts = new ADAGrad.Options) extends Grad {
  
	var sumSq:Array[Mat] = null;
  var ve:Mat = null;
  var one:Mat = null;

  override def init(model0:Model) = {
    initGrad(model0);
    val nmats = modelmats.length;
    val mm = modelmats(0);
    sumSq = new Array[Mat](nmats);
    for (i <- 0 until nmats) {
    	sumSq(i) = modelmats(i).ones(modelmats(i).dims) *@ opts.initsumsq
    }
    ve = mm.zeros(opts.vexp.nrows, opts.vexp.ncols);
    one = mm.ones(1,1);<commit_msg>Fix adadgrad null modelmat bug<commit_after>package BIDMach.updaters
 
import BIDMat.{Mat,SBMat,CMat,DMat,FMat,IMat,HMat,GMat,GIMat,GSMat,SMat,SDMat,TMat}
import BIDMat.MatFunctions._
import BIDMat.SciFunctions._
import BIDMach.models._
import edu.berkeley.bid.CUMACH
import edu.berkeley.bid.CPUMACH
import jcuda.runtime.JCuda._
import scala.concurrent.Future
import scala.concurrent.ExecutionContext.Implicits.global

class ADAGrad(override val opts:ADAGrad.Opts = new ADAGrad.Options) extends Grad {
  
	var sumSq:Array[Mat] = null;
  var ve:Mat = null;
  var one:Mat = null;

  override def init(model0:Model) = {
    initGrad(model0);
    val nmats = modelmats.length;
    val mm = modelmats(0);
    sumSq = new Array[Mat](nmats);
    for (i <- 0 until nmats) {
      if (modelmats(i).asInstanceOf[AnyRef] != null) {
      	sumSq(i) = modelmats(i).ones(modelmats(i).dims) *@ opts.initsumsq;
      }
    }
    ve = mm.zeros(opts.vexp.nrows, opts.vexp.ncols);
    one = mm.ones(1,1);
{'fraction_non_alphanumeric': 0.1282458929517753, 'fraction_numerical': 0.006359300476947536, 'mean_word_length': 4.273743016759776, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6951517', 'n_tokens_mistral': 759, 'n_tokens_neox': 754, 'n_words': 132}