@@ -301,21 +301,15 @@ def check_ope_inputs(
301
301
302
302
# estimated_rewards_by_reg_model
303
303
if estimated_rewards_by_reg_model is not None :
304
- if not isinstance (estimated_rewards_by_reg_model , np .ndarray ):
305
- raise ValueError ("estimated_rewards_by_reg_model must be ndarray" )
306
304
if estimated_rewards_by_reg_model .shape != action_dist .shape :
307
305
raise ValueError (
308
306
"estimated_rewards_by_reg_model.shape must be the same as action_dist.shape"
309
307
)
310
308
311
309
# action, reward
312
310
if action is not None or reward is not None :
313
- if not isinstance (action , np .ndarray ):
314
- raise ValueError ("action must be ndarray" )
315
311
if action .ndim != 1 :
316
312
raise ValueError ("action must be 1-dimensional" )
317
- if not isinstance (reward , np .ndarray ):
318
- raise ValueError ("reward must be ndarray" )
319
313
if reward .ndim != 1 :
320
314
raise ValueError ("reward must be 1-dimensional" )
321
315
if not (action .shape [0 ] == reward .shape [0 ]):
@@ -329,8 +323,6 @@ def check_ope_inputs(
329
323
330
324
# pscore
331
325
if pscore is not None :
332
- if not isinstance (pscore , np .ndarray ):
333
- raise ValueError ("pscore must be ndarray" )
334
326
if pscore .ndim != 1 :
335
327
raise ValueError ("pscore must be 1-dimensional" )
336
328
if not (action .shape [0 ] == reward .shape [0 ] == pscore .shape [0 ]):
@@ -671,21 +663,15 @@ def check_ope_inputs_tensor(
671
663
672
664
# estimated_rewards_by_reg_model
673
665
if estimated_rewards_by_reg_model is not None :
674
- if not isinstance (estimated_rewards_by_reg_model , torch .Tensor ):
675
- raise ValueError ("estimated_rewards_by_reg_model must be Tensor" )
676
666
if estimated_rewards_by_reg_model .shape != action_dist .shape :
677
667
raise ValueError (
678
668
"estimated_rewards_by_reg_model.shape must be the same as action_dist.shape"
679
669
)
680
670
681
671
# action, reward
682
672
if action is not None or reward is not None :
683
- if not isinstance (action , torch .Tensor ):
684
- raise ValueError ("action must be Tensor" )
685
673
if action .ndim != 1 :
686
674
raise ValueError ("action must be 1-dimensional" )
687
- if not isinstance (reward , torch .Tensor ):
688
- raise ValueError ("reward must be Tensor" )
689
675
if reward .ndim != 1 :
690
676
raise ValueError ("reward must be 1-dimensional" )
691
677
if not (action .shape [0 ] == reward .shape [0 ]):
@@ -699,8 +685,6 @@ def check_ope_inputs_tensor(
699
685
700
686
# pscore
701
687
if pscore is not None :
702
- if not isinstance (pscore , torch .Tensor ):
703
- raise ValueError ("pscore must be Tensor" )
704
688
if pscore .ndim != 1 :
705
689
raise ValueError ("pscore must be 1-dimensional" )
706
690
if not (action .shape [0 ] == reward .shape [0 ] == pscore .shape [0 ]):
0 commit comments