title: TypeError: __call__() takes from 1 to 2 positional arguments but 3 were given
body: <p>I'm trying to do mutli-label image classification and I'm trying to convert the image data set into TFRecords format.</p>
  <p>Here is my Code:</p>
  <pre><code>        def _bytes_feature(value):
            if isinstance(value,type(tf.cosntant(0))):
              value = value.numpy()
            return tf.train.Feature(byte_list=tf.train.BytesList(value=[value]))
          
          def _float_feature(value):
            return tf.train.Feature(float_list=tf.train.FloatList(value=[value]))
          
          def _int64_feature(value):
            return tf.train.Feature(int64_list = tf.train.Int64List(value=[value]))
          
          def image_example(image_string,image_name, df):
            image_shape = tf.image.decode_png(image_string).shape
            
            feature = {
            'height': _int64_feature(image_shape[0]),
            'width': _int64_feature(image_shape[1]),
            'depth': _int64_feature(image_shape[2]),
            'label_1': _int64_feature(df.loc(image_name,'Atelectasis')),
            'label_2': _int64_feature(df.loc(image_name,'Cardiomegaly')),
            'label_3': _int64_feature(df.loc(image_name,'Consolidation')),
            'label_4': _int64_feature(df.loc(image_name,'Edema')),
            'label_5': _int64_feature(df.loc(image_name,'Effusion')),
            'label_6': _int64_feature(df.loc(image_name,'Emphysema')),
            'label_7': _int64_feature(df.loc(image_name,'Fibrosis')),
            'label_8': _int64_feature(df.loc(image_name,'Hernia')),
            'label_9': _int64_feature(df.loc(image_name,'Infiltration')),
            'label_10': _int64_feature(df.loc(image_name,'Mass')),
            'label_11': _int64_feature(df.loc(image_name,'Nodule')),
            'label_12': _int64_feature(df.loc(image_name,'Pleural_Thickening')),
            'label_13': _int64_feature(df.loc(image_name,'Pneumonia')),
            'label_14': _int64_feature(df.loc(image_name,'Pneumothorax')),
            'label_15': _int64_feature(df.loc(image_name,'No Finding')),
            'image_raw': _bytes_feature(image_string),
            }
            return tf.train.example(features = tf.train.Features(feature=feature))
  
  
    
  
  record_image = 'image.tfrecords'
  with tf.io.TFRecordWriter(record_image) as write:
    for row in df.index:
      full_path = '/content/images/'+df['Image Index'][row]
      image_string = tf.io.read_file(full_path)
      image_name = pd.Series(df['Image Index'])[row]
      tf_example = image_example(image_string, image_name, df)
      write.write(tf_example.SerializeToString())
  </code></pre>
  <p>But it throws the error:</p>
  <pre><code>TypeError                                 Traceback (most recent call last)
  &lt;ipython-input-66-f42cc357d799&gt; in &lt;module&gt;()
        5     image_string = tf.io.read_file(full_path)
        6     image_name = pd.Series(df['Image Index'])[row]
  ----&gt; 7     tf_example = image_example(image_string,image_name,df)
        8     write.write(tf_example.SerializeToString())
  
  &lt;ipython-input-64-de0476ade753&gt; in image_example(image_string, image_name, df)
       17   'width': _int64_feature(image_shape[1]),
       18   'depth': _int64_feature(image_shape[2]),
  ---&gt; 19   'label_1': _int64_feature(df.loc(image_name,'Atelectasis')),
       20   'label_2': _int64_feature(df.loc(image_name,'Cardiomegaly')),
       21   'label_3': _int64_feature(df.loc(image_name,'Consolidation')),
  
  TypeError: __call__() takes from 1 to 2 positional arguments but 3 were given
  </code></pre>
  <p>Q1) Is it okay if I store the features like this? Cant the models from tensorflowHub understand it. Can I &quot;tell&quot; the models what to expect as the input?</p>
  <p>Q2) Why am I getting that error? Image_example clearly takes 3 arguments.</p>