<commit_before><script src="https://unpkg.com/deeplearn@0.5.0/dist/deeplearn.js"> </script> 

<script>

// Class myTensor.htmlPrint parameters    
    
// myDiv : HTML div tag id to put table or textarea into, 
// myTitle : optional string table title. Default no title, 
// myTableBoolean : optional boolean true print as a table, false print flattened in a textarea. Default true,
// myFixedDecimal : optiona  integer print to fixed decimal places Default -1 no effect.   
        
class myTensor extends dl.Tensor {
    async htmlPrint(myDiv, myTitle='', myTableBoolean=true, myFixedDecimal=-1)  {
           
       document.getElementById(myDiv).innerHTML = '<b>'+myTitle + '</b><br>'
       const myOutput =  await this.data()
       //console.log('?? = '+this.indexToLoc(4))
       //console.log('?? = '+ myOutput[this.locToIndex([1,1,0])])

       
       
       if (myTableBoolean){           
          var myTotalOutput = ''
          //console.log('shape2'+this.shape[2])
          if (this.rank==2){
              console.log('rank 2')
               var myTemp = '<table border=1><tr>'
               for (var myRow=0; myRow <= this.shape[0]-1; myRow++){
                  for (var myCol=0; myCol <= this.shape[1]-1; myCol++){                
                       if (myFixedDecimal >=0){
                             myTemp += '<td>'+myOutput[this.locToIndex([myRow, myCol])].toFixed(myFixedDecimal) +'</td>'   
                       } else {
                            myTemp += '<td>'+myOutput[this.locToIndex([myRow, myCol])] +'</td>'  
                       } 
                  }
                   myTemp += '</tr><tr>'
               }
              myTemp += '</table>'
              document.getElementById(myDiv).innerHTML += myTemp + '<br>'
            }
           
           if (this.rank==3){
               console.log('rank 3')
               var myTemp = '<table border=1>\n<tr><td>\n'
               for (var my3D=0; my3D <= this.shape[2]-1; my3D++){  // 3D part table of tables in each row
                     myTemp += '<table border=1 width=100%>\n<tr>'
                  for (var myRow=0; myRow <= this.shape[0]-1; myRow++){
                     for (var myCol=0; myCol <= this.shape[1]-1; myCol++){ 
                         //console.log(my3D+', '+myRow+', '+myCol);
                          if (myFixedDecimal >=0){
                             myTemp += '<td>'+myOutput[this.locToIndex([my3D, myCol, myRow])].toFixed(myFixedDecimal) +'</td>'   
                          } else {
                            myTemp += '<td>'+myOutput[this.locToIndex([my3D, myCol, myRow])] +'</td>'  
                          } 
                         //console.log(myTemp)
                     }
                     myTemp += '</tr>\n<tr>'
                  }
                  myTemp += '</table>\n</td><td>\n'
               } 
               myTemp += '\n</table>'
               console.log(myTemp)
              document.getElementById(myDiv).innerHTML += myTemp + '<br>'
            }
             
           
           
           
           

       } else {      // end table output start flattened textarea output 
            var myTemp = '<textarea rows=10 cols=70>'
            for (var myCount = 0;    myCount <= this.size - 1;   myCount++){ 
                if (myFixedDecimal >=0){
                   myTemp += myOutput[myCount].toFixed(myFixedDecimal) + ', ' 
                } else {
                    myTemp += myOutput[myCount] +', '
                }     
            } 
            myTemp += '</textarea>'
            document.getElementById(myDiv).innerHTML += myTemp + '<br>'
       }    // end myTableBoolean else
    }       // end htmlPrint
}           // end myTensor class
    
</script>
xcv
toFixed <input id="myText01" type=text size=2 value=-1> less than 0 to ignore<br>
<input type="button" value="tensor.htmlPrint()" onclick="{

   const myWeights  = new myTensor([3,4,2],'float32',[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]);

   myWeights.print()
   myDec = document.getElementById('myText01').value
   myWeights.htmlPrint('myDiv01',  'Weights [3,4,2]', true, myDec)



}"><br>



<div id="myDiv01"></div><br><commit_msg>Update table17.html<commit_after><script src="https://unpkg.com/deeplearn@0.5.0/dist/deeplearn.js"> </script> 

<script>

// Class myTensor.htmlPrint parameters    
    
// myDiv : HTML div tag id to put table or textarea into, 
// myTitle : optional string table title. Default no title, 
// myTableBoolean : optional boolean true print as a table, false print flattened in a textarea. Default true,
// myFixedDecimal : optiona  integer print to fixed decimal places Default -1 no effect.   
        
class myTensor extends dl.Tensor {
    async htmlPrint(myDiv, myTitle='', myTableBoolean=true, myFixedDecimal=-1)  {
           
       document.getElementById(myDiv).innerHTML = '<b>'+myTitle + '</b><br>'
       const myOutput =  await this.data()
       //console.log('?? = '+this.indexToLoc(4))
       //console.log('?? = '+ myOutput[this.locToIndex([1,1,0])])

       
       
       if (myTableBoolean){           
          var myTotalOutput = ''
          //console.log('shape2'+this.shape[2])
          if (this.rank==2){
              console.log('rank 2')
               var myTemp = '<table border=1><tr>'
               for (var myRow=0; myRow <= this.shape[0]-1; myRow++){
                  for (var myCol=0; myCol <= this.shape[1]-1; myCol++){                
                       if (myFixedDecimal >=0){
                             myTemp += '<td>'+myOutput[this.locToIndex([myRow, myCol])].toFixed(myFixedDecimal) +'</td>'   
                       } else {
                            myTemp += '<td>'+myOutput[this.locToIndex([myRow, myCol])] +'</td>'  
                       } 
                  }
                   myTemp += '</tr><tr>'
               }
              myTemp += '</table>'
              document.getElementById(myDiv).innerHTML += myTemp + '<br>'
            }
           
           if (this.rank==3){
               console.log('rank 3')
               var myTemp = '<table border=1>\n<tr><td>\n'
               for (var my3D=0; my3D <= this.shape[2]-1; my3D++){  // 3D part table of tables in each row
                     myTemp += '<table border=1 width=100%>\n<tr>'
                  for (var myRow=0; myRow <= this.shape[0]-1; myRow++){
                     for (var myCol=0; myCol <= this.shape[1]-1; myCol++){ 
                         //console.log(my3D+', '+myRow+', '+myCol);
                          if (myFixedDecimal >=0){
                             myTemp += '<td>'+myOutput[this.locToIndex([my3D, myCol, myRow])].toFixed(myFixedDecimal) +'</td>'   
                          } else {
                            myTemp += '<td>'+myOutput[this.locToIndex([my3D, myCol, myRow])] +'</td>'  
                          } 
                         //console.log(myTemp)
                     }
                     myTemp += '</tr>\n<tr>'
                  }
                  myTemp += '</table>\n</td><td>\n'
               } 
               myTemp += '\n</table>'
               console.log(myTemp)
              document.getElementById(myDiv).innerHTML += myTemp + '<br>'
            }
             
           
           
           
           

       } else {      // end table output start flattened textarea output 
            var myTemp = '<textarea rows=10 cols=70>'
            for (var myCount = 0;    myCount <= this.size - 1;   myCount++){ 
                if (myFixedDecimal >=0){
                   myTemp += myOutput[myCount].toFixed(myFixedDecimal) + ', ' 
                } else {
                    myTemp += myOutput[myCount] +', '
                }     
            } 
            myTemp += '</textarea>'
            document.getElementById(myDiv).innerHTML += myTemp + '<br>'
       }    // end myTableBoolean else
    }       // end htmlPrint
}           // end myTensor class
    
</script>

toFixed <input id="myText01" type=text size=2 value=-1> less than 0 to ignore<br>
ver17
<input type="button" value="tensor.htmlPrint()" onclick="{

   const myWeights  = new myTensor([3,4,2],'float32',[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]);

   myWeights.print()
   myDec = document.getElementById('myText01').value
   myWeights.htmlPrint('myDiv01',  'Weights [3,4,2]', true, myDec)



}"><br>



<div id="myDiv01"></div><br>
{'fraction_non_alphanumeric': 0.15390985448953035, 'fraction_numerical': 0.02649946764462321, 'mean_word_length': 1.5448524984948826, 'pattern_counts': {'":': 0, '<': 101, '<?xml version=': 0, '>': 95, 'https://': 2, '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': '2725034', 'n_tokens_mistral': 2633, 'n_tokens_neox': 2464, 'n_words': 516}