Tensorflow error : unsupported callable

后端 未结 1 893
刺人心
刺人心 2021-02-06 15:30

I follow the tutorial https://www.tensorflow.org/tutorials/layers and I want use it to use my own dataset.

def train_input_fn_custom(filenames_array, labels_arra         


        
1条回答
  •  旧巷少年郎
    2021-02-06 16:25

    The input_fn argument to classifier.train() must be a callable object (with no arguments), such as a function or a lambda. In your code, you are passing the results of calling train_input_fn_custom(), rather than a callable object that invokes train_input_fn_custom(). To fix this issue, replace the definition of cust_train_input_fn as follows:

    # The `lambda:` creates a callable object with no arguments.
    cust_train_input_fn = lambda: train_input_fn_custom(
        filenames_array=filenames_train, labels_array=labels_train, batch_size=3)
    

    0 讨论(0)
提交回复
热议问题