Hi thank you for your response.
I replaced the first argument with the test data(used tutorial pages online).
I received the following error:
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/sklearn/utils/validation.py in _num_samples(x)
    158     try:
--> 159         return len(x)
    160     except TypeError:

8 frames
/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py in __len__(self)
    390             # Cannot statically verify that dataset is Sized
--> 391             length = self._IterableDataset_len_called = len(self.dataset)  # type: ignore
    392             if self.batch_size is not None:  # IterableDataset doesn't allow custom sampler or batch_sampler

/content/drive/MyDrive/square_data_set_generation1.py in __len__(self)
    212         iterator_len= self.puzzle_piece_pair_iterator()
--> 213         return len(shuffle_buffer_iterator(iterator_len, self.size_of_buffer))
    214 

TypeError: object of type 'generator' has no len()

During handling of the above exception, another exception occurred:

TypeError                                 Traceback (most recent call last)
<ipython-input-33-acd6e6d62fc6> in <module>()
      5               board_writer,
      6               device,
----> 7               batches_per_epoch=500)

<ipython-input-20-02e3c875a1cb> in train_it(no_of_epochs, starting_epoch, model_name, model, loss_criterion, optimizer, batch_size, allTheDataloaders, board_writer, device, batches_per_epoch, is_best, min_validation_loss)
    140     y_test=allTheDataloaders["Testing"]
    141     t_predicitions=[t.squeeze().tolist() for t in t_predicitions]
--> 142     print(classification_report(y_test, t_predicitions))
    143 
    144 

/usr/local/lib/python3.7/dist-packages/sklearn/metrics/_classification.py in classification_report(y_true, y_pred, labels, target_names, sample_weight, digits, output_dict, zero_division)
   1969     """
   1970 
-> 1971     y_type, y_true, y_pred = _check_targets(y_true, y_pred)
   1972 
   1973     labels_given = True

/usr/local/lib/python3.7/dist-packages/sklearn/metrics/_classification.py in _check_targets(y_true, y_pred)
     78     y_pred : array or indicator matrix
     79     """
---> 80     check_consistent_length(y_true, y_pred)
     81     type_true = type_of_target(y_true)
     82     type_pred = type_of_target(y_pred)

/usr/local/lib/python3.7/dist-packages/sklearn/utils/validation.py in check_consistent_length(*arrays)
    206     """
    207 
--> 208     lengths = [_num_samples(X) for X in arrays if X is not None]
    209     uniques = np.unique(lengths)
    210     if len(uniques) > 1:

/usr/local/lib/python3.7/dist-packages/sklearn/utils/validation.py in <listcomp>(.0)
    206     """
    207 
--> 208     lengths = [_num_samples(X) for X in arrays if X is not None]
    209     uniques = np.unique(lengths)
    210     if len(uniques) > 1:

/usr/local/lib/python3.7/dist-packages/sklearn/utils/validation.py in _num_samples(x)
    159         return len(x)
    160     except TypeError:
--> 161         raise TypeError(message)
    162 
    163 

TypeError: Expected sequence or array-like, got <class 'torch.utils.data.dataloader.DataLoader'>

The Adjancey dataset consists of a len:
(This file is written is from github and alterations were made)
from PIL import Image

import matplotlib.pyplot as plt

import matplotlib.ticker as plticker

import os

import pprint

import itertools

from collections import defaultdict

# generate random integer values

from random import seed

from random import randint

import numpy as np

#from pylab import array

from random import sample

import math

#pytorch modules

import torch

from torch.utils.data import Dataset, DataLoader, IterableDataset

from torchvision import transforms, utils

#TODO:FIX THE BLACK ISSUE PART

from google.colab import drive

drive.mount('/content/drive')

os.environ['MY_ROOT_DIR'] = '/content/drive/MyDrive/path_to_directory/train'

def shuffle_buffer_iterator(actual_iterator, size_of_buffer):

    shuffle = []

    while(True):

        size = 0

        while(size < size_of_buffer):

            try:

                shuffle.append(next(actual_iterator))

                size +=1

            except StopIteration:

                shuffle = sample(shuffle, len(shuffle))    

                for s in shuffle:

                    yield s

                return

        

        shuffle = sample(shuffle, len(shuffle))    

        for s in shuffle:

            yield s

        shuffle = []

class AdjacencyDataset(IterableDataset):

    def __init__(self, root_dir, sq_puzzle_piece_dim, size_of_buffer, model_dim):

        super(IterableDataset).__init__()

        self.root_dir = root_dir

        self.sq_puzzle_piece_dim = sq_puzzle_piece_dim

        self.size_of_buffer = size_of_buffer

        self.model_dim = model_dim

        

    def make_the_puzzle_grid(self, rows, cols):

        list_of_labels = []

        for x in range(rows):

            for y in range(cols):

                list_of_labels.append((x,y))

        dist_dict = defaultdict(list)

        for pos, (x, y) in enumerate(list_of_labels):

            for a,b in list_of_labels[pos+1: ]:

                d = (a-x)**2 + (b-y)**2

                dist_dict[d].append([(x,y), (a,b)])

        size_dist_dict = {}

        for d in dist_dict:

            size_dist_dict[d] = len(dist_dict[d])

        no_of_non_adjacent_pairs = 0

        for d in size_dist_dict:

            no_of_non_adjacent_pairs += size_dist_dict[d]

        no_of_non_adjacent_pairs -= size_dist_dict[1]

        no_of_adjacent_pairs = size_dist_dict[1]

        #There are no_of_non_adjacent_pairs non-adjacent pairs.

        #How to choose no_of_adjacent_pairs  pairs of non-adjacent pieces ?

        #no_of_non_adjacent_pairs*x = no_of_adjacent_pairs

        x  = no_of_adjacent_pairs/no_of_non_adjacent_pairs

        no_of_rep = {}

        for d in size_dist_dict:

            no_of_rep[d] = math.ceil(size_dist_dict[d]*x)

        no_of_rep[1] = size_dist_dict[1]

        return list_of_labels, dist_dict, size_dist_dict, no_of_rep

    

    def transform_input(self, piece_1, piece_2):

        width = self.model_dim

        height = self.model_dim

        piece_1 = piece_1.resize((width, height))

        piece_2 = piece_2.resize((width, height))

        juxtaposed = Image.new('RGB', (2*width, height), color=0)

        #juxtaposed.paste(piece_i ,

        #(left_upper_row, left_upper_col, 

        #right_lower_row, right_lower_col))

        juxtaposed.paste(piece_1,(0,0,width, height))

        juxtaposed.paste(piece_2,(width,0,2*width, height))

        juxtaposed = juxtaposed.crop((width//2, 0,width//2 + width,height))

        return transforms.ToTensor()(juxtaposed)

#Ref:https://stackoverflow.com/questions/54799457/force-pillow-to-generate-an-image-with-the-truecolor-type-while-i-only-use-blac

#Images do not match error

#https://note.nkmk.me/en/python-pillow-concat-images/

    def join_pieces_h(self,piece_1,piece_2):

         width=50

         height=50

         juxtaposed_h = Image.new('RGB', (piece_1.width + piece_2.width, piece_1.height))

         juxtaposed_h.paste(piece_1, (0, 0))

         juxtaposed_h.paste(piece_2, (piece_1.width, 0))

         return transforms.ToTensor()(juxtaposed_h)

    def transform_input_black_image(self,piece_1,piece_2):

        width = self.model_dim

        height = self.model_dim

        #piece_1 = piece_1.resize((width, height))

        #piece_2 = piece_2.resize((width, height))

        juxtaposed_black_background=Image.new('RGB',(width,height)(0,0,0)) 

        juxtaposed_black_background_copy=juxtaposed_black_background.copy()

        juxtaposed_black_background_copy.paste()

##the image is pasted continue by pasting the squares ontop 

        juxtaposed_black.paste(piece_1,(0,0,width, height))

        juxtaposed_black.paste(piece_2,(width,0,2*width, height))

        juxtaposed_black = juxtaposed_black.crop((width, 0,width + width,height))

        return transforms.ToTensor()(juxtaposed_black)  

                        

#/content/drive/MyDrive/path_to_directory/train/1/image_06734.jpg

    def puzzle_piece_pair_iterator(self):

        for folder in sample(os.listdir(self.root_dir), len(os.listdir(self.root_dir))):

            folder_path = self.root_dir+"/"+folder

            print(folder_path)

            for image in sample(os.listdir(folder_path), len(os.listdir(folder_path))):

                current_image = Image.open(folder_path + "/"+image)

                

                original_image_height = current_image.size[1]

                original_image_width =  current_image.size[0] 

                

                puzzle_piece_height = self.sq_puzzle_piece_dim

                puzzle_piece_width = self.sq_puzzle_piece_dim

                

                rows = round(original_image_height/puzzle_piece_height)

                cols = round(original_image_width/puzzle_piece_width)

                

                list_of_labels, dist_dict, size_dist_dict, no_of_rep = self.make_the_puzzle_grid(rows,cols) 

                

                new_image_height = rows*puzzle_piece_height

                new_image_width = cols*puzzle_piece_width

                

                current_image = current_image.resize((new_image_width, new_image_height))

                

                puzzle_pieces = []

                i = 0

                j = 0

                while(i < rows):

                    row_puzzle_pieces = []

                    row_puzzle_pieces_torchtensor = []

                    while(j < cols):

                        crop_piece = current_image.crop((j*puzzle_piece_width,i*puzzle_piece_height,(j+1)*puzzle_piece_width,(i+1)*puzzle_piece_height))

                        row_puzzle_pieces.append(crop_piece)

                        j += 1

                    puzzle_pieces.append(row_puzzle_pieces)

                    i += 1

                    j = 0

                puzzle_piece_crop_list = []

                for d in dist_dict:

                    puzzle_piece_crop_list.extend(sample(dist_dict[d], no_of_rep[d]))

                

                for label_pairs in sample(puzzle_piece_crop_list, len(puzzle_piece_crop_list)):

                    x, y = label_pairs[0]

                    a, b = label_pairs[1]

                    are_adjacent = (((x-a)**2 + (y-b)**2)==1)

                    piece_1 = puzzle_pieces[x][y]

                    piece_2 = puzzle_pieces[a][b]

                    if are_adjacent:

                        if abs(a-x)==1:

                            #rotate piece_1_torchtensor counterclockwise by 90

                            #rotate piece_2_torchtensor counterclockwise by 90

                            piece_1 = puzzle_pieces[x][y].rotate(90)

                            piece_2 = puzzle_pieces[a][b].rotate(90)

                    if are_adjacent:

                        label = 1

                    else:

                        label = 0

                    

                    juxtaposed_pieces_torchtensor = self.join_pieces_h(piece_1, piece_2)

                    yield (juxtaposed_pieces_torchtensor,label)

            

    def __iter__(self):

        my_iterator = self.puzzle_piece_pair_iterator()

        return shuffle_buffer_iterator(my_iterator, self.size_of_buffer)

    def __len__(self):

        iterator_len= self.puzzle_piece_pair_iterator()

        return len(shuffle_buffer_iterator(iterator_len, self.size_of_buffer))


The train method of the model:

def train_it(no_of_epochs, starting_epoch, 
              model_name,model,loss_criterion, optimizer,
              batch_size, allTheDataloaders,board_writer,device,batches_per_epoch=100,
              is_best=False,min_validation_loss=math.inf):

    last_checkpoint_path = f"./last_checkpoint_for_{model_name}.pt"
    best_model_path=f"./best_model_for_{model_name}.pt"
    
    #to_track_info = ["epoch", "total time", "train loss"]
    #f val_loader is not None:
      #  to_track_info.append("val loss")
    #for eval_score in score_funcs:
     #   to_track_info.append("train " + eval_score )
      #  if val_loader is not None:
       #     to_track_info.append("val " + eval_score )
    
   # results={}

    #for j in to_track_info:
     #  results[j]=[]
    for epoch in range(starting_epoch,starting_epoch+no_of_epochs):
        print(f"Epoch : {epoch}")
        start_time = time()

        model.train()

     
        print("Training")
        train_loss_in_this_epoch = 0
        no_of_batches_in_this_epoch = 0
        train_correct_in_this_epoch = 0
        for train_batch_data, train_batch_labels in allTheDataloaders["Training"]:
                train_batch_data, train_batch_labels = train_batch_data.to(device), train_batch_labels.to(device)
                no_of_batches_in_this_epoch+= 1
                optimizer.zero_grad()
                train_batch_outputs = model(train_batch_data)
                #Compute loss for this batch
                train_batch_loss = loss_criterion(train_batch_outputs, train_batch_labels)
                train_loss_in_this_batch = train_batch_loss.item()
                train_loss_in_this_epoch += train_loss_in_this_batch 
                train_batch_loss.backward()
                optimizer.step()
                with torch.no_grad():
                    new_pred=torch.max(train_batch_outputs, axis = 1) 
                    train_score, train_predictions = torch.max(train_batch_outputs, axis = 1)   
                    train_correct_in_this_batch = torch.sum(train_predictions == train_batch_labels.data).item()
                    train_correct_in_this_epoch += train_correct_in_this_batch
                    train_batch_labels = train_batch_labels.detach().cpu().numpy()
                    train_score = train_score.detach().cpu().numpy()


                if (no_of_batches_in_this_epoch % (batches_per_epoch//10)) == 0:
                    print(f"Training #{no_of_batches_in_this_epoch} Batch Acc : {train_correct_in_this_batch}/{batch_size}, Batch Loss: {train_loss_in_this_batch}")
                if no_of_batches_in_this_epoch == batches_per_epoch:
                    print(f"Epoch : {epoch}, Training Batch: {no_of_batches_in_this_epoch}")
                    break
     #  results["epoch"].append( epoch )
      # results["total time"].append( time()-start_time) )
       #results["train loss"].append( train_loss_in_this_epoch )
     #   t_predicitions = np.asarray(t_predicitions)
        
#        if t_predicitions.shape[1] > 1: #We have a classification problem, convert to labels
     #   t_predicitions = np.argmax(t_predicitions, axis=1)
            
      #  for name, score_func in score_cal.items():
       #     results["train " + name].append( score_cal(t_labels, t_predicitions) )

        board_writer.add_scalar(f'Training/Loss/Average', train_loss_in_this_epoch/no_of_batches_in_this_epoch, epoch)
        board_writer.add_scalar(f'Training/Accuracy/Average', train_correct_in_this_epoch/(no_of_batches_in_this_epoch*batch_size), epoch)
        board_writer.add_scalar(f'Training/TimeTakenInMinutes', (time()-start_time)/60, epoch)
        board_writer.flush()
        print(f"Training average accuracy : {train_correct_in_this_epoch/(no_of_batches_in_this_epoch*batch_size)}")
        print(f"Training average loss : {train_loss_in_this_epoch/no_of_batches_in_this_epoch}")
            
        #create f measure
        model.eval()
        print("Validation")
        val_loss_in_this_epoch = 0
        no_of_batches_in_this_epoch = 0
        val_correct_in_this_epoch = 0
        with torch.no_grad():
            for val_batch_data, val_batch_labels in allTheDataloaders["Validation"]:
                val_batch_data, val_batch_labels = val_batch_data.to(device), val_batch_labels.to(device)
                no_of_batches_in_this_epoch+= 1
                val_batch_outputs = model(val_batch_data)
                #Compute loss for this batch
                val_batch_loss = loss_criterion(val_batch_outputs, val_batch_labels)
                val_loss_in_this_batch = val_batch_loss.item()
                val_loss_in_this_epoch += val_loss_in_this_batch 
                val_score, val_predictions = torch.max(val_batch_outputs, axis = 1)   
                val_correct_in_this_batch = torch.sum(val_predictions == val_batch_labels.data).item()
                val_correct_in_this_epoch += val_correct_in_this_batch
                if (no_of_batches_in_this_epoch % (batches_per_epoch//10)) == 0:
                    print(f"Validation #{no_of_batches_in_this_epoch} Batch Acc : {val_correct_in_this_batch}/{batch_size}, Batch Loss: {val_loss_in_this_batch}")
                if no_of_batches_in_this_epoch == batches_per_epoch:
                    print(f"Epoch : {epoch}, Validation Batch: {no_of_batches_in_this_epoch}")
                    break
            board_writer.add_scalar(f'Validation/Loss/Average', val_loss_in_this_epoch/no_of_batches_in_this_epoch, epoch)
            board_writer.add_scalar(f'Validation/Accuracy/Average', val_correct_in_this_epoch/(no_of_batches_in_this_epoch*batch_size), epoch)
            board_writer.add_scalar(f'Validation/TimeTakenInMinutes', (time()-start_time)/60, epoch)
            board_writer.flush()
            print(f"Validation average accuracy : {val_correct_in_this_epoch/(no_of_batches_in_this_epoch*batch_size)}")
            print(f"Validation average loss : {val_loss_in_this_epoch/no_of_batches_in_this_epoch}")
            if  min_validation_loss >= val_loss_in_this_epoch:
                    is_best = True
                    min_validation_loss = min(min_validation_loss,val_loss_in_this_epoch)
                    checkpoint = {
                        'epoch': epoch + 1,
                        'min_validation_loss': min_validation_loss,
                        'state_dict': model.state_dict(),
                        'optimizer': optimizer.state_dict(),
                    }
                    save_the_models_at_the_best_checkpoint(checkpoint, is_best, last_checkpoint_path, best_model_path)
                    print(f"In epoch number {epoch}, average validation loss decreased to {val_loss_in_this_epoch/no_of_batches_in_this_epoch}")
            load_the_models_at_the_best_checkpoint = {
                    'epoch': epoch + 1,
                    'min_validation_loss': min_validation_loss,
                    'state_dict': model.state_dict(),
                    'optimizer': optimizer.state_dict(),
                     }
            save_the_models_at_the_best_checkpoint(load_the_models_at_the_best_checkpoint, False, last_checkpoint_path, best_model_path)

    board_writer.close()
    #from sklearn.metrics import classification_report, confusion_matrix, accuracy_score
   # print(confusion_matrix(t_labels,t_predicitions))
    #print(classification_report(t_labels,scores))
   # print(metrics.classification_report (t_labels, t_predicitions))
   # print(accuracy_score(t_labels, t_predicitions))
    t_labels=[]
    t_predicitions=[]
    with torch.no_grad():
        model.eval()
        for test_batch_data,test_batch_labels in allTheDataloaders["Testing"]:
            test_batch_data, test_batch_labels = test_batch_data.to(device), test_batch_labels.to(device)
            y_test_pred=model(test_batch_data)
            _, y_pred_targets = torch.max(y_test_pred, dim = 1)
            t_predicitions.append(y_pred_targets.cpu().numpy())
    y_test=allTheDataloaders["Testing"]
    t_predicitions=[t.squeeze().tolist() for t in t_predicitions]
    print(classification_report(y_test, t_predicitions))

Sorry I am new to python,pytorch and machine learning.
Any explanations or guidance would be useful.
Thank you.