@@ -443,7 +443,7 @@ public override void Forward(in Tensor x, out Tensor z, out Tensor a)
443
443
}
444
444
445
445
/// <inheritdoc/>
446
- public override void Backpropagate ( in Tensor delta_1 , in Tensor z , ActivationFunction activationPrime )
446
+ public override void Backpropagate ( in Tensor dy , in Tensor z , ActivationFunction activationPrime )
447
447
{
448
448
using ( DeviceMemory < float >
449
449
dx_gpu = DnnInstance . Gpu . AllocateDevice < float > ( z . Size ) ,
@@ -452,7 +452,7 @@ public override void Backpropagate(in Tensor delta_1, in Tensor z, ActivationFun
452
452
// First 1x1 convolution
453
453
DnnInstance . GetConvolutionBackwardDataAlgorithm ( _1x1FilterDescription , _1x1OutputDescription , _1x1ConvolutionDescription , InputDescription , ConvolutionBwdDataPreference . PREFER_FASTEST , IntPtr . Zero , out ConvolutionBwdDataAlgo algorithm ) ;
454
454
DnnInstance . GetConvolutionBackwardDataWorkspaceSize ( _1x1FilterDescription , _1x1OutputDescription , _1x1ConvolutionDescription , InputDescription , algorithm , out IntPtr size ) ;
455
- using ( DeviceMemory < float > dy_gpu = DnnInstance . Gpu . AllocateDevice ( delta_1 , 0 , InputInfo . SliceSize * OperationInfo . Primary1x1ConvolutionKernels ) )
455
+ using ( DeviceMemory < float > dy_gpu = DnnInstance . Gpu . AllocateDevice ( dy , 0 , InputInfo . SliceSize * OperationInfo . Primary1x1ConvolutionKernels ) )
456
456
using ( DeviceMemory < byte > workspace_gpu = DnnInstance . Gpu . AllocateDevice < byte > ( size ) )
457
457
{
458
458
DnnInstance . ConvolutionBackwardData ( 1 , _1x1FilterDescription , w_gpu . Ptr , _1x1OutputDescription , dy_gpu . Ptr , _1x1ConvolutionDescription , algorithm , workspace_gpu . Ptr , size , 0 , InputDescription , dx_gpu . Ptr ) ;
@@ -465,7 +465,7 @@ public override void Backpropagate(in Tensor delta_1, in Tensor z, ActivationFun
465
465
DnnInstance . GetConvolutionBackwardDataAlgorithm ( _3x3FilterDescription , _3x3OutputDescription , _3x3ConvolutionDescription , _3x3Reduce1x1OutputDescription , ConvolutionBwdDataPreference . PREFER_FASTEST , IntPtr . Zero , out algorithm ) ;
466
466
DnnInstance . GetConvolutionBackwardDataWorkspaceSize ( _3x3FilterDescription , _3x3OutputDescription , _3x3ConvolutionDescription , _3x3Reduce1x1OutputDescription , algorithm , out size ) ;
467
467
using ( DeviceMemory < float >
468
- dy_gpu = DnnInstance . Gpu . AllocateDevice ( delta_1 , InputInfo . SliceSize * OperationInfo . Primary1x1ConvolutionKernels , InputInfo . SliceSize * OperationInfo . Secondary3x3ConvolutionKernels ) ,
468
+ dy_gpu = DnnInstance . Gpu . AllocateDevice ( dy , InputInfo . SliceSize * OperationInfo . Primary1x1ConvolutionKernels , InputInfo . SliceSize * OperationInfo . Secondary3x3ConvolutionKernels ) ,
469
469
_3x3Reduce1x1dx_gpu = DnnInstance . Gpu . AllocateDevice < float > ( _3x3Reduce1x1Z . Size ) )
470
470
using ( DeviceMemory < byte > workspace_gpu = DnnInstance . Gpu . AllocateDevice < byte > ( size ) )
471
471
{
@@ -493,7 +493,7 @@ public override void Backpropagate(in Tensor delta_1, in Tensor z, ActivationFun
493
493
DnnInstance . GetConvolutionBackwardDataAlgorithm ( _5x5FilterDescription , _5x5OutputDescription , _5x5ConvolutionDescription , _5x5Reduce1x1OutputDescription , ConvolutionBwdDataPreference . PREFER_FASTEST , IntPtr . Zero , out algorithm ) ;
494
494
DnnInstance . GetConvolutionBackwardDataWorkspaceSize ( _5x5FilterDescription , _5x5OutputDescription , _5x5ConvolutionDescription , _5x5Reduce1x1OutputDescription , algorithm , out size ) ;
495
495
using ( DeviceMemory < float >
496
- dy_gpu = DnnInstance . Gpu . AllocateDevice ( delta_1 , InputInfo . SliceSize * ( OperationInfo . Primary1x1ConvolutionKernels + OperationInfo . Secondary3x3ConvolutionKernels ) , InputInfo . SliceSize * OperationInfo . Secondary5x5ConvolutionKernels ) ,
496
+ dy_gpu = DnnInstance . Gpu . AllocateDevice ( dy , InputInfo . SliceSize * ( OperationInfo . Primary1x1ConvolutionKernels + OperationInfo . Secondary3x3ConvolutionKernels ) , InputInfo . SliceSize * OperationInfo . Secondary5x5ConvolutionKernels ) ,
497
497
_5x5Reduce1x1dx_gpu = DnnInstance . Gpu . AllocateDevice < float > ( _5x5Reduce1x1Z . Size ) )
498
498
using ( DeviceMemory < byte > workspace_gpu = DnnInstance . Gpu . AllocateDevice < byte > ( size ) )
499
499
{
@@ -521,7 +521,7 @@ public override void Backpropagate(in Tensor delta_1, in Tensor z, ActivationFun
521
521
DnnInstance . GetConvolutionBackwardDataAlgorithm ( Secondary1x1FilterDescription , Secondary1x1OutputDescription , _1x1ConvolutionDescription , PoolingOutputDescription , ConvolutionBwdDataPreference . PREFER_FASTEST , IntPtr . Zero , out algorithm ) ;
522
522
DnnInstance . GetConvolutionBackwardDataWorkspaceSize ( Secondary1x1FilterDescription , Secondary1x1OutputDescription , _1x1ConvolutionDescription , PoolingOutputDescription , algorithm , out size ) ;
523
523
using ( DeviceMemory < float >
524
- dy_gpu = DnnInstance . Gpu . AllocateDevice ( delta_1 , InputInfo . SliceSize * ( OperationInfo . Primary1x1ConvolutionKernels + OperationInfo . Secondary3x3ConvolutionKernels + OperationInfo . Secondary5x5ConvolutionKernels ) , InputInfo . SliceSize * OperationInfo . Secondary1x1AfterPoolingConvolutionKernels ) ,
524
+ dy_gpu = DnnInstance . Gpu . AllocateDevice ( dy , InputInfo . SliceSize * ( OperationInfo . Primary1x1ConvolutionKernels + OperationInfo . Secondary3x3ConvolutionKernels + OperationInfo . Secondary5x5ConvolutionKernels ) , InputInfo . SliceSize * OperationInfo . Secondary1x1AfterPoolingConvolutionKernels ) ,
525
525
poolDx_gpu = DnnInstance . Gpu . AllocateDevice < float > ( _PoolingZ . Size ) )
526
526
using ( DeviceMemory < byte > workspace_gpu = DnnInstance . Gpu . AllocateDevice < byte > ( size ) )
527
527
{
0 commit comments