{"action":"created","issue":{"url":"https://api.github.com/repos/tensorflow/cleverhans/issues/471","repository_url":"https://api.github.com/repos/tensorflow/cleverhans","labels_url":"https://api.github.com/repos/tensorflow/cleverhans/issues/471/labels{/name}","comments_url":"https://api.github.com/repos/tensorflow/cleverhans/issues/471/comments","events_url":"https://api.github.com/repos/tensorflow/cleverhans/issues/471/events","html_url":"https://github.com/tensorflow/cleverhans/issues/471","id":343816066,"node_id":"MDU6SXNzdWUzNDM4MTYwNjY=","number":471,"title":"CarliniWagner, DeepFool, ElasticNetMethod, LBFGS Do not work with ModelBasicCNN","user":{"login":"summermjj","id":41390615,"node_id":"MDQ6VXNlcjQxMzkwNjE1","avatar_url":"https://avatars0.githubusercontent.com/u/41390615?v=4","gravatar_id":"","url":"https://api.github.com/users/summermjj","html_url":"https://github.com/summermjj","followers_url":"https://api.github.com/users/summermjj/followers","following_url":"https://api.github.com/users/summermjj/following{/other_user}","gists_url":"https://api.github.com/users/summermjj/gists{/gist_id}","starred_url":"https://api.github.com/users/summermjj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/summermjj/subscriptions","organizations_url":"https://api.github.com/users/summermjj/orgs","repos_url":"https://api.github.com/users/summermjj/repos","events_url":"https://api.github.com/users/summermjj/events{/privacy}","received_events_url":"https://api.github.com/users/summermjj/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"david-berthelot","id":1187052,"node_id":"MDQ6VXNlcjExODcwNTI=","avatar_url":"https://avatars3.githubusercontent.com/u/1187052?v=4","gravatar_id":"","url":"https://api.github.com/users/david-berthelot","html_url":"https://github.com/david-berthelot","followers_url":"https://api.github.com/users/david-berthelot/followers","following_url":"https://api.github.com/users/david-berthelot/following{/other_user}","gists_url":"https://api.github.com/users/david-berthelot/gists{/gist_id}","starred_url":"https://api.github.com/users/david-berthelot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/david-berthelot/subscriptions","organizations_url":"https://api.github.com/users/david-berthelot/orgs","repos_url":"https://api.github.com/users/david-berthelot/repos","events_url":"https://api.github.com/users/david-berthelot/events{/privacy}","received_events_url":"https://api.github.com/users/david-berthelot/received_events","type":"User","site_admin":false},"assignees":[{"login":"david-berthelot","id":1187052,"node_id":"MDQ6VXNlcjExODcwNTI=","avatar_url":"https://avatars3.githubusercontent.com/u/1187052?v=4","gravatar_id":"","url":"https://api.github.com/users/david-berthelot","html_url":"https://github.com/david-berthelot","followers_url":"https://api.github.com/users/david-berthelot/followers","following_url":"https://api.github.com/users/david-berthelot/following{/other_user}","gists_url":"https://api.github.com/users/david-berthelot/gists{/gist_id}","starred_url":"https://api.github.com/users/david-berthelot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/david-berthelot/subscriptions","organizations_url":"https://api.github.com/users/david-berthelot/orgs","repos_url":"https://api.github.com/users/david-berthelot/repos","events_url":"https://api.github.com/users/david-berthelot/events{/privacy}","received_events_url":"https://api.github.com/users/david-berthelot/received_events","type":"User","site_admin":false}],"milestone":null,"comments":3,"created_at":"2018-07-23T22:18:03Z","updated_at":"2018-07-27T23:01:27Z","closed_at":null,"author_association":"NONE","body":"The `ModelBasicCNN` defined in `cleverhans_tutorials.tutorial_models` does not work with the following attacks: CarliniWagner, DeepFool, ElasticNetMethod and LBFGS.\r\nI don't know exactly what the reason is, but it seems that the output tensor of generate function cannot infer the shape of the input."},"comment":{"url":"https://api.github.com/repos/tensorflow/cleverhans/issues/comments/408559273","html_url":"https://github.com/tensorflow/cleverhans/issues/471#issuecomment-408559273","issue_url":"https://api.github.com/repos/tensorflow/cleverhans/issues/471","id":408559273,"node_id":"MDEyOklzc3VlQ29tbWVudDQwODU1OTI3Mw==","user":{"login":"summermjj","id":41390615,"node_id":"MDQ6VXNlcjQxMzkwNjE1","avatar_url":"https://avatars0.githubusercontent.com/u/41390615?v=4","gravatar_id":"","url":"https://api.github.com/users/summermjj","html_url":"https://github.com/summermjj","followers_url":"https://api.github.com/users/summermjj/followers","following_url":"https://api.github.com/users/summermjj/following{/other_user}","gists_url":"https://api.github.com/users/summermjj/gists{/gist_id}","starred_url":"https://api.github.com/users/summermjj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/summermjj/subscriptions","organizations_url":"https://api.github.com/users/summermjj/orgs","repos_url":"https://api.github.com/users/summermjj/repos","events_url":"https://api.github.com/users/summermjj/events{/privacy}","received_events_url":"https://api.github.com/users/summermjj/received_events","type":"User","site_admin":false},"created_at":"2018-07-27T23:01:27Z","updated_at":"2018-07-27T23:01:27Z","author_association":"NONE","body":"`import tensorflow as tf\r\nimport numpy as np\r\n\r\ntf.reset_default_graph()\r\n\r\n(x_train, y_train), (x_test, y_test) = tf.keras.datasets.mnist.load_data()\r\nx_train = np.expand_dims(x_train, axis=3).astype('float32')/255\r\nx_test = np.expand_dims(x_test, axis=3).astype('float32')/255\r\ninput_shape = (28, 28, 1)\r\n\r\nx_train = x_train[0:1000]\r\ny_train = y_train[0:1000]\r\nx_test = x_test[0:100]\r\ny_test = y_test[0:100]\r\n\r\nnb_classes = 10\r\ny_train = tf.keras.utils.to_categorical(y_train, nb_classes)\r\ny_test = tf.keras.utils.to_categorical(y_test, nb_classes)\r\nprint(\"x_train shape =\", x_train.shape)\r\nprint('y_train shape =', y_train.shape)\r\nprint (\"x_test shape =\", x_test.shape)\r\n\r\nfrom cleverhans.attacks import CarliniWagnerL2\r\ncw = CarliniWagnerL2(tf_model, sess=sess)\r\n\r\ncw_params = {'binary_search_steps': 5,\r\n              'max_iterations': 100,\r\n              'clip_min': -10,\r\n              'clip_max': 10,\r\n             'learning_rate': .005,\r\n             'initial_const': 0.01,\r\n            'batch_size' : 1,\r\n            'confidence': 0,\r\n            'abort_early': True}\r\n\r\nadv_x = cw.generate(x, **cw_params)\r\nadv_preds = tf_model.get_logits(adv_x)\r\nadv_acc = model_eval(sess, x, y, adv_preds, x_test, y_test, args=eval_params)\r\nprint(adv_acc)`\r\n\r\nAnd here is the error that I get:\r\n\r\n`---------------------------------------------------------------------------\r\nValueError                                Traceback (most recent call last)\r\n<ipython-input-5-06a227f123df> in <module>()\r\n     12             'abort_early': True}\r\n     13 adv_x = cw.generate(x, **cw_params)\r\n---> 14 adv_preds = tf_model.get_logits(adv_x)\r\n     15 adv_acc = model_eval(sess, x, y, adv_preds, x_test, y_test, args=eval_params)\r\n     16 print(adv_acc)\r\n\r\nc:\\users\\mjafarnia\\src\\cleverhans\\cleverhans\\model.py in get_logits(self, x, **kwargs)\r\n     39         (i.e., the values fed as inputs to the softmax layer).\r\n     40         \"\"\"\r\n---> 41         return self.fprop(x, **kwargs)[self.O_LOGITS]\r\n     42 \r\n     43     def get_probs(self, x, **kwargs):\r\n\r\nc:\\users\\mjafarnia\\src\\cleverhans\\cleverhans_tutorials\\tutorial_models.py in fprop(***failed resolving arguments***)\r\n     25                                     kernel_initializer=HeReLuNormalInitializer)\r\n     26         with tf.variable_scope(self.scope, reuse=tf.AUTO_REUSE):\r\n---> 27             y = my_conv(x, self.nb_filters, 8, strides=2, padding='same')\r\n     28             y = my_conv(y, 2 * self.nb_filters, 6, strides=2, padding='valid')\r\n     29             y = my_conv(y, 2 * self.nb_filters, 5, strides=1, padding='valid')\r\n\r\n~\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\tensorflow\\python\\layers\\convolutional.py in conv2d(inputs, filters, kernel_size, strides, padding, data_format, dilation_rate, activation, use_bias, kernel_initializer, bias_initializer, kernel_regularizer, bias_regularizer, activity_regularizer, kernel_constraint, bias_constraint, trainable, name, reuse)\r\n    425       _reuse=reuse,\r\n    426       _scope=name)\r\n--> 427   return layer.apply(inputs)\r\n    428 \r\n    429 \r\n\r\n~\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\tensorflow\\python\\keras\\engine\\base_layer.py in apply(self, inputs, *args, **kwargs)\r\n    772       Output tensor(s).\r\n    773     \"\"\"\r\n--> 774     return self.__call__(inputs, *args, **kwargs)\r\n    775 \r\n    776   def _set_learning_phase_metadata(self, inputs, outputs):\r\n\r\n~\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\tensorflow\\python\\layers\\base.py in __call__(self, inputs, *args, **kwargs)\r\n    327 \r\n    328       # Actually call layer\r\n--> 329       outputs = super(Layer, self).__call__(inputs, *args, **kwargs)\r\n    330 \r\n    331     if not context.executing_eagerly():\r\n\r\n~\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\tensorflow\\python\\keras\\engine\\base_layer.py in __call__(self, inputs, *args, **kwargs)\r\n    686 \r\n    687         # Check input assumptions set before layer building, e.g. input rank.\r\n--> 688         self._assert_input_compatibility(inputs)\r\n    689         if input_list and self._dtype is None:\r\n    690           try:\r\n\r\n~\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\tensorflow\\python\\keras\\engine\\base_layer.py in _assert_input_compatibility(self, inputs)\r\n   1379         if x.get_shape().ndims is None:\r\n   1380           raise ValueError('Input ' + str(input_index) + ' of layer ' +\r\n-> 1381                            self.name + ' is incompatible with the layer: '\r\n   1382                            'its rank is undefined, but the layer requires a '\r\n   1383                            'defined rank.')\r\n\r\nValueError: Input 0 of layer conv2d_19 is incompatible with the layer: its rank is undefined, but the layer requires a defined rank.`\r\n\r\n**Note:** I can successfully use cw attack using generate_np function, but I was just curious why generate function gives me this error."}}
{"actor":{"display_login":"summermjj"}}