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