title: NSRANGE Exception
body: <p>So I'm following <a href="https://www.tensorflow.org/tutorials/generative/dcgan#train_the_model" rel="nofollow noreferrer">this</a> guide on my M1. Everything is the same except for a few tweaks of the model and my train function looks like</p>
  <pre><code>def train(EPOCHS,BATCH_SIZE,DATASET):
  
    for epoch in range(EPOCHS):
      
      start = time.time()
      for BATCH in DATASET:
       
        train_step(BATCH)
        print(DATASET.index(BATCH))
      #save_img(epoch)
      print(f'Epoch:{epoch} took {time.time()-start} seconds')
  
  </code></pre>
  <p>When I try to run it I get this long error</p>
  <pre><code>*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndexedSubscript:]: index 1 beyond bounds [0 .. 0]'
  *** First throw call stack:
  (
          0   CoreFoundation                      0x000000018bc94c78 __exceptionPreprocess + 240
          1   libobjc.A.dylib                     0x000000018b9bd0a8 objc_exception_throw + 60
          2   CoreFoundation                      0x000000018bd5fb68 -[__NSCFString characterAtIndex:].cold.1 + 0
          3   CoreFoundation                      0x000000018bc02ae8 -[__NSCFString hasSuffix:] + 0
          4   MLCompute                           0x000000019512816c -[MLCTrainingGraph resultGradientTensorToUseByExecuteGradientForLayer:sourceIndex:incrementIntermediateIndex:] + 208
          5   MLCompute                           0x0000000195129658 -[MLCTrainingGraph allocateGradientTensorsForLayersInGraph:] + 672
          6   MLCompute                           0x000000019512a0b8 -[MLCTrainingGraph compileAndAllocateGradientTensorsForGraph:] + 140
          7   MLCompute                           0x0000000195134394 -[MLCTrainingGraph executeGradientWithBatchSize:options:outputsData:completionHandler:] + 968
          8   _pywrap_tensorflow_internal.so      0x00000001029659b8 _ZN10tensorflow9mlcompute7kernels13MLCSubgraphOp23ExecuteMLCTrainingGraphEPNS_15OpKernelContextEPNS1_10MLCContextEj + 580
          9   _pywrap_tensorflow_internal.so      0x00000001029646ac _ZN10tensorflow9mlcompute7kernels13MLCSubgraphOp20ProcessMLCSubgraphOpEPNS_15OpKernelContextEPPNS1_10MLCContextEPPNS1_15TFContextStatusE + 948
          10  _pywrap_tensorflow_internal.so      0x00000001029671c0 _ZN10tensorflow9mlcompute7kernels13MLCSubgraphOp7ComputeEPNS_15OpKernelContextE + 804
          11  libtensorflow_framework.2.dylib     0x0000000116137598 _ZN10tensorflow12_GLOBAL__N_113ExecutorStateINS_21SimplePropagatorStateEE7ProcessENS2_10TaggedNodeEx + 2772
          12  libtensorflow_framework.2.dylib     0x00000001161aa50c _ZN5Eigen15ThreadPoolTemplIN10tensorflow6thread16EigenEnvironmentEE10WorkerLoopEi + 552
          13  libtensorflow_framework.2.dylib     0x00000001161aa1e4 _ZZN10tensorflow6thread16EigenEnvironment12CreateThreadENSt3__18functionIFvvEEEENKUlvE_clEv + 80
          14  libtensorflow_framework.2.dylib     0x000000011619bacc _ZN10tensorflow12_GLOBAL__N_17PThread8ThreadFnEPv + 104
          15  libsystem_pthread.dylib             0x000000018bb17878 _pthread_start + 320
          16  libsystem_pthread.dylib             0x000000018bb125e0 thread_start + 8
  )
  libc++abi: terminating with uncaught exception of type NSException
  
  </code></pre>
  <p>From what I've researched so far I'm pretty sure this error shows up mostly in apps, and I think I have a different error but the way Mac runs it causes this error.</p>
  <p>Anyways, how would I go about solving this?</p>