@@ -4354,6 +4354,7 @@ function convByOutputChannelAndInputSlicing(input, filter, biases, stride, pad,
4354
4354
res . layers [ i ] . dilationRate ,
4355
4355
3 ) ; // important for memory use
4356
4356
}
4357
+
4357
4358
// Log memory usage
4358
4359
const memoryInfo = tf . memory ( ) ;
4359
4360
console . log ( `Iteration ${ i } :` ) ;
@@ -4362,6 +4363,8 @@ function convByOutputChannelAndInputSlicing(input, filter, biases, stride, pad,
4362
4363
console . log ( `Bytes In Use: ${ memoryInfo . numBytes } ` ) ;
4363
4364
console . log ( `Megabytes In Use: ${ ( memoryInfo . numBytes / 1048576 ) . toFixed ( 3 ) } MB` ) ;
4364
4365
console . log ( `Unreliable: ${ memoryInfo . unreliable } ` ) ;
4366
+
4367
+
4365
4368
tf . dispose ( curTensor [ i - 1 ] ) ;
4366
4369
4367
4370
} catch ( err ) {
@@ -4759,26 +4762,30 @@ function convByOutputChannelAndInputSlicing(input, filter, biases, stride, pad,
4759
4762
let timer = window . setInterval ( async function ( ) {
4760
4763
4761
4764
try {
4762
- if ( res . layers [ i ] . activation . getClassName ( ) !== 'linear' ) {
4765
+ // if (res.layers[i].activation.getClassName() !== 'linear') {
4763
4766
curTensor [ i ] = res . layers [ i ] . apply ( curTensor [ i - 1 ] ) ;
4764
- } else {
4767
+ // } else {
4768
+
4769
+ // curTensor[i] = convByOutputChannelAndInputSlicing(curTensor[i-1],
4770
+ // res.layers[i].getWeights()[0],
4771
+ // res.layers[i].getWeights()[1],
4772
+ // res.layers[i].strides,
4773
+ // res.layers[i].padding,
4774
+ // res.layers[i].dilationRate,
4775
+ // 3); // important for memory use
4776
+ // }
4777
+
4778
+
4779
+ // // Log memory usage
4780
+ // const memoryInfo = tf.memory();
4781
+ // console.log(`Iteration ${i}:`);
4782
+ // console.log(`Number of Tensors: ${memoryInfo.numTensors}`);
4783
+ // console.log(`Number of Data Buffers: ${memoryInfo.numDataBuffers}`);
4784
+ // console.log(`Bytes In Use: ${memoryInfo.numBytes}`);
4785
+ // console.log(`Megabytes In Use: ${(memoryInfo.numBytes / 1048576).toFixed(3)} MB`);
4786
+ // console.log(`Unreliable: ${memoryInfo.unreliable}`);
4787
+
4765
4788
4766
- curTensor [ i ] = convByOutputChannelAndInputSlicing ( curTensor [ i - 1 ] ,
4767
- res . layers [ i ] . getWeights ( ) [ 0 ] ,
4768
- res . layers [ i ] . getWeights ( ) [ 1 ] ,
4769
- res . layers [ i ] . strides ,
4770
- res . layers [ i ] . padding ,
4771
- res . layers [ i ] . dilationRate ,
4772
- 3 ) ; // important for memory use
4773
- }
4774
- // Log memory usage
4775
- const memoryInfo = tf . memory ( ) ;
4776
- console . log ( `Iteration ${ i } :` ) ;
4777
- console . log ( `Number of Tensors: ${ memoryInfo . numTensors } ` ) ;
4778
- console . log ( `Number of Data Buffers: ${ memoryInfo . numDataBuffers } ` ) ;
4779
- console . log ( `Bytes In Use: ${ memoryInfo . numBytes } ` ) ;
4780
- console . log ( `Megabytes In Use: ${ ( memoryInfo . numBytes / 1048576 ) . toFixed ( 3 ) } MB` ) ;
4781
- console . log ( `Unreliable: ${ memoryInfo . unreliable } ` ) ;
4782
4789
tf . dispose ( curTensor [ i - 1 ] ) ;
4783
4790
4784
4791
} catch ( err ) {
@@ -5952,18 +5959,7 @@ get3dObjectBoundingVolume = async(slices_3d) => {
5952
5959
5953
5960
try {
5954
5961
//-- curTensor[i] = res.layers[i].apply( curTensor[i-1]);
5955
- // if (res.layers[i].activation.getClassName() !== 'linear') {
5956
- curTensor [ i ] = res . layers [ i ] . apply ( curTensor [ i - 1 ] ) ;
5957
- // } else {
5958
-
5959
- // curTensor[i] = convByOutputChannelAndInputSlicing(curTensor[i-1],
5960
- // res.layers[i].getWeights()[0],
5961
- // res.layers[i].getWeights()[1],
5962
- // res.layers[i].strides,
5963
- // res.layers[i].padding,
5964
- // res.layers[i].dilationRate,
5965
- // 3); // important for memory use
5966
- // }
5962
+ curTensor [ i ] = res . layers [ i ] . apply ( curTensor [ i - 1 ] ) ;
5967
5963
5968
5964
} catch ( err ) {
5969
5965
0 commit comments