@@ -1232,7 +1232,7 @@ public interface IModule<T1, T2, T3, T4, T5, T6, TResult>
1232
1232
/// <summary>
1233
1233
/// Represents a module that accepts 'hook' to the module logic.
1234
1234
/// </summary>
1235
- public class HookableModule < TModule , TPreHook , TPostHook > : Module
1235
+ public class HookableModule < TPreHook , TPostHook > : Module
1236
1236
{
1237
1237
protected HookableModule ( string name ) : base ( name ) { }
1238
1238
@@ -1253,14 +1253,14 @@ public HookRemover register_forward_pre_hook(TPreHook hook)
1253
1253
return new HookRemover ( this , key ) ;
1254
1254
}
1255
1255
1256
- public HookRemover register_forward_hook ( Action < TModule > hook )
1256
+ public HookRemover register_forward_hook ( Action < Module > hook )
1257
1257
{
1258
1258
var key = Guid . NewGuid ( ) . ToString ( ) ;
1259
1259
module_post_hooks . Add ( key , hook ) ;
1260
1260
return new HookRemover ( this , key ) ;
1261
1261
}
1262
1262
1263
- public HookRemover register_forward_pre_hook ( Action < TModule > hook )
1263
+ public HookRemover register_forward_pre_hook ( Action < Module > hook )
1264
1264
{
1265
1265
var key = Guid . NewGuid ( ) . ToString ( ) ;
1266
1266
module_pre_hooks . Add ( key , hook ) ;
@@ -1278,16 +1278,16 @@ private void remove(string key)
1278
1278
protected Dictionary < string , TPreHook > pre_hooks = new Dictionary < string , TPreHook > ( ) ;
1279
1279
protected Dictionary < string , TPostHook > post_hooks = new Dictionary < string , TPostHook > ( ) ;
1280
1280
1281
- protected Dictionary < string , Action < TModule > > module_pre_hooks = new Dictionary < string , Action < TModule > > ( ) ;
1282
- protected Dictionary < string , Action < TModule > > module_post_hooks = new Dictionary < string , Action < TModule > > ( ) ;
1281
+ protected Dictionary < string , Action < Module > > module_pre_hooks = new Dictionary < string , Action < Module > > ( ) ;
1282
+ protected Dictionary < string , Action < Module > > module_post_hooks = new Dictionary < string , Action < Module > > ( ) ;
1283
1283
1284
1284
/// <summary>
1285
1285
/// Used to remove a specific hook, following the PyTorch API design.
1286
1286
/// </summary>
1287
1287
/// <remarks>The name and namespace of this class is not the same as in PyTorch, but serves the same purpose.</remarks>
1288
1288
public class HookRemover
1289
1289
{
1290
- public HookRemover ( HookableModule < TModule , TPreHook , TPostHook > module , string key )
1290
+ public HookRemover ( HookableModule < TPreHook , TPostHook > module , string key )
1291
1291
{
1292
1292
this . module = module ;
1293
1293
this . key = key ;
@@ -1298,7 +1298,7 @@ public void remove()
1298
1298
module . remove ( key ) ;
1299
1299
}
1300
1300
1301
- private HookableModule < TModule , TPreHook , TPostHook > module ;
1301
+ private HookableModule < TPreHook , TPostHook > module ;
1302
1302
private string key ;
1303
1303
}
1304
1304
}
@@ -1308,7 +1308,7 @@ public void remove()
1308
1308
/// </summary>
1309
1309
/// <typeparam name="T">The argument type of the module's forward() function.</typeparam>
1310
1310
/// <typeparam name="TResult">The return type of the module's forward() function.</typeparam>
1311
- public abstract class Module < T , TResult > : HookableModule < Module < T , TResult > , Func < Module < T , TResult > , T , T > , Func < Module < T , TResult > , T , TResult , TResult > > , IModule < T , TResult >
1311
+ public abstract class Module < T , TResult > : HookableModule < Func < Module < T , TResult > , T , T > , Func < Module < T , TResult > , T , TResult , TResult > > , IModule < T , TResult >
1312
1312
{
1313
1313
protected Module ( string name ) : base ( name ) { }
1314
1314
protected Module ( IntPtr handle , IntPtr boxedHandle ) : base ( handle , boxedHandle ) { }
@@ -1362,7 +1362,7 @@ public TResult call(T input)
1362
1362
/// <typeparam name="T1">The first argument type of the module's forward() function.</typeparam>
1363
1363
/// <typeparam name="T2">The second argument type of the module's forward() function.</typeparam>
1364
1364
/// <typeparam name="TResult">The return type of the module's forward() function.</typeparam>
1365
- public abstract class Module < T1 , T2 , TResult > : HookableModule < Module < T1 , T2 , TResult > , Func < Module < T1 , T2 , TResult > , T1 , T2 , ( T1 , T2 ) ? > , Func < Module < T1 , T2 , TResult > , T1 , T2 , TResult , TResult > > , IModule < T1 , T2 , TResult >
1365
+ public abstract class Module < T1 , T2 , TResult > : HookableModule < Func < Module < T1 , T2 , TResult > , T1 , T2 , ( T1 , T2 ) ? > , Func < Module < T1 , T2 , TResult > , T1 , T2 , TResult , TResult > > , IModule < T1 , T2 , TResult >
1366
1366
{
1367
1367
protected Module ( string name ) : base ( name ) { }
1368
1368
protected Module ( IntPtr handle , IntPtr boxedHandle ) : base ( handle , boxedHandle ) { }
@@ -1419,7 +1419,7 @@ public TResult call(T1 input1, T2 input2)
1419
1419
/// <typeparam name="T2">The second argument type of the module's forward() function.</typeparam>
1420
1420
/// <typeparam name="T3">The third argument type of the module's forward() function.</typeparam>
1421
1421
/// <typeparam name="TResult">The return type of the module's forward() function.</typeparam>
1422
- public abstract class Module < T1 , T2 , T3 , TResult > : HookableModule < Module < T1 , T2 , T3 , TResult > , Func < Module < T1 , T2 , T3 , TResult > , T1 , T2 , T3 , ( T1 , T2 , T3 ) ? > , Func < Module < T1 , T2 , T3 , TResult > , T1 , T2 , T3 , TResult , TResult > > , IModule < T1 , T2 , T3 , TResult >
1422
+ public abstract class Module < T1 , T2 , T3 , TResult > : HookableModule < Func < Module < T1 , T2 , T3 , TResult > , T1 , T2 , T3 , ( T1 , T2 , T3 ) ? > , Func < Module < T1 , T2 , T3 , TResult > , T1 , T2 , T3 , TResult , TResult > > , IModule < T1 , T2 , T3 , TResult >
1423
1423
{
1424
1424
protected Module ( string name ) : base ( name ) { }
1425
1425
protected Module ( IntPtr handle , IntPtr boxedHandle ) : base ( handle , boxedHandle ) { }
@@ -1478,7 +1478,7 @@ public TResult call(T1 input1, T2 input2, T3 input3)
1478
1478
/// <typeparam name="T3">The third argument type of the module's forward() function.</typeparam>
1479
1479
/// <typeparam name="T4">The fourth argument type of the module's forward() function.</typeparam>
1480
1480
/// <typeparam name="TResult">The return type of the module's forward() function.</typeparam>
1481
- public abstract class Module < T1 , T2 , T3 , T4 , TResult > : HookableModule < Module < T1 , T2 , T3 , T4 , TResult > , Func < Module < T1 , T2 , T3 , T4 , TResult > , T1 , T2 , T3 , T4 , ( T1 , T2 , T3 , T4 ) ? > , Func < Module < T1 , T2 , T3 , T4 , TResult > , T1 , T2 , T3 , T4 , TResult , TResult > > , IModule < T1 , T2 , T3 , T4 , TResult >
1481
+ public abstract class Module < T1 , T2 , T3 , T4 , TResult > : HookableModule < Func < Module < T1 , T2 , T3 , T4 , TResult > , T1 , T2 , T3 , T4 , ( T1 , T2 , T3 , T4 ) ? > , Func < Module < T1 , T2 , T3 , T4 , TResult > , T1 , T2 , T3 , T4 , TResult , TResult > > , IModule < T1 , T2 , T3 , T4 , TResult >
1482
1482
{
1483
1483
protected Module ( string name ) : base ( name ) { }
1484
1484
protected Module ( IntPtr handle , IntPtr boxedHandle ) : base ( handle , boxedHandle ) { }
@@ -1539,7 +1539,7 @@ public TResult call(T1 input1, T2 input2, T3 input3, T4 input4)
1539
1539
/// <typeparam name="T4">The fourth argument type of the module's forward() function.</typeparam>
1540
1540
/// <typeparam name="T5">The fifth argument type of the module's forward() function.</typeparam>
1541
1541
/// <typeparam name="TResult">The return type of the module's forward() function.</typeparam>
1542
- public abstract class Module < T1 , T2 , T3 , T4 , T5 , TResult > : HookableModule < Module < T1 , T2 , T3 , T4 , T5 , TResult > , Func < Module < T1 , T2 , T3 , T4 , T5 , TResult > , T1 , T2 , T3 , T4 , T5 , ( T1 , T2 , T3 , T4 , T5 ) ? > , Func < Module < T1 , T2 , T3 , T4 , T5 , TResult > , T1 , T2 , T3 , T4 , T5 , TResult , TResult > > , IModule < T1 , T2 , T3 , T4 , T5 , TResult >
1542
+ public abstract class Module < T1 , T2 , T3 , T4 , T5 , TResult > : HookableModule < Func < Module < T1 , T2 , T3 , T4 , T5 , TResult > , T1 , T2 , T3 , T4 , T5 , ( T1 , T2 , T3 , T4 , T5 ) ? > , Func < Module < T1 , T2 , T3 , T4 , T5 , TResult > , T1 , T2 , T3 , T4 , T5 , TResult , TResult > > , IModule < T1 , T2 , T3 , T4 , T5 , TResult >
1543
1543
{
1544
1544
protected Module ( string name ) : base ( name ) { }
1545
1545
protected Module ( IntPtr handle , IntPtr boxedHandle ) : base ( handle , boxedHandle ) { }
@@ -1602,7 +1602,7 @@ public TResult call(T1 input1, T2 input2, T3 input3, T4 input4, T5 input5)
1602
1602
/// <typeparam name="T5">The fifth argument type of the module's forward() function.</typeparam>
1603
1603
/// <typeparam name="T6">The sixth argument type of the module's forward() function.</typeparam>
1604
1604
/// <typeparam name="TResult">The return type of the module's forward() function.</typeparam>
1605
- public abstract class Module < T1 , T2 , T3 , T4 , T5 , T6 , TResult > : HookableModule < Module < T1 , T2 , T3 , T4 , T5 , T6 , TResult > , Func < Module < T1 , T2 , T3 , T4 , T5 , T6 , TResult > , T1 , T2 , T3 , T4 , T5 , T6 , ( T1 , T2 , T3 , T4 , T5 , T6 ) ? > , Func < Module < T1 , T2 , T3 , T4 , T5 , T6 , TResult > , T1 , T2 , T3 , T4 , T5 , T6 , TResult , TResult > > , IModule < T1 , T2 , T3 , T4 , T5 , T6 , TResult >
1605
+ public abstract class Module < T1 , T2 , T3 , T4 , T5 , T6 , TResult > : HookableModule < Func < Module < T1 , T2 , T3 , T4 , T5 , T6 , TResult > , T1 , T2 , T3 , T4 , T5 , T6 , ( T1 , T2 , T3 , T4 , T5 , T6 ) ? > , Func < Module < T1 , T2 , T3 , T4 , T5 , T6 , TResult > , T1 , T2 , T3 , T4 , T5 , T6 , TResult , TResult > > , IModule < T1 , T2 , T3 , T4 , T5 , T6 , TResult >
1606
1606
{
1607
1607
protected Module ( string name ) : base ( name ) { }
1608
1608
protected Module ( IntPtr handle , IntPtr boxedHandle ) : base ( handle , boxedHandle ) { }
0 commit comments