Check sess is provided when using TF in Attacks
@@ -29,8 +29,12 @@ class Attack(object):
"""
if not(back == 'tf' or back == 'th'):
raise ValueError("Backend argument must either be 'tf' or 'th'.")
+
if back == 'th' and sess is not None:
raise Exception("A session should not be provided when using th.")
+ elif back == 'tf' and sess is None:
+ raise ValueError("A session should be provided when using tf.")
+
if not isinstance(model, Model):
if hasattr(model, '__call__'):
warnings.warn("CleverHans support for supplying a callable"
