parameters: (self, net, inputs=None, blobs_to_check=None, ignore=None)
return_statement: return success
docstring: Checks a network by inspecting all of its intermediate results, and
          see if things match.
docstring_summary: Checks a network by inspecting all of its intermediate results, and
          see if things match.
docstring_tokens: Checks a network by inspecting all of its intermediate results and see if things match .
function: def CheckNet(self, net, inputs=None, blobs_to_check=None, ignore=None):
          """Checks a network by inspecting all of its intermediate results, and
          see if things match.
          """
          if inputs is None:
              inputs = {}
          if ignore is None:
              ignore = set()
          old_ws_name = workspace.CurrentWorkspace()
          results = []
          if blobs_to_check is None:
              blobs_to_check = sum([list(op.output) for op in net.op], [])
          blobs_to_check = [b for b in blobs_to_check if b not in ignore]
          workspace.SwitchWorkspace("_device_check_", True)
          for device_option in self._device_options:
              for name, arr in viewitems(inputs):
                  # print 'feeding', name
                  workspace.FeedBlob(name, arr, device_option)
              for op in net.op:
                  op.device_option.CopyFrom(device_option)
              workspace.RunNetOnce(net)
              results.append(
                  [workspace.FetchBlob(name) for name in blobs_to_check]
              )
          # After running on all devices, check correctness
          success = True
          for i in range(1, len(results)):
              for j in range(len(blobs_to_check)):
                  x = results[i][j]
                  y = results[0][j]
                  if not np.allclose(x, y,
                                     atol=self._threshold, rtol=self._threshold):
                      print('Failure in checking device option {}'
                            ' and output {}. The outputs are:'
                            .format(i, blobs_to_check[j]))
                      print(x.flatten())
                      print(y.flatten())
                      print(np.max(np.abs(x - y)))
                      success = False
                  # else:
                  #     print ('Passed device pair (%d, %d), %s %s: %s' %
                  #            (i, j, blobs_to_check[j], y.shape,
                  #             str(y.flatten())))
          workspace.SwitchWorkspace(old_ws_name)
          return success
function_tokens: def CheckNet ( self , net , inputs = None , blobs_to_check = None , ignore = None ) : if inputs is None : inputs = { } if ignore is None : ignore = set ( ) old_ws_name = workspace . CurrentWorkspace ( ) results = [ ] if blobs_to_check is None : blobs_to_check = sum ( [ list ( op . output ) for op in net . op ] , [ ] ) blobs_to_check = [ b for b in blobs_to_check if b not in ignore ] workspace . SwitchWorkspace ( "_device_check_" , True ) for device_option in self . _device_options : for name , arr in viewitems ( inputs ) : # print 'feeding', name workspace . FeedBlob ( name , arr , device_option ) for op in net . op : op . device_option . CopyFrom ( device_option ) workspace . RunNetOnce ( net ) results . append ( [ workspace . FetchBlob ( name ) for name in blobs_to_check ] ) # After running on all devices, check correctness success = True for i in range ( 1 , len ( results ) ) : for j in range ( len ( blobs_to_check ) ) : x = results [ i ] [ j ] y = results [ 0 ] [ j ] if not np . allclose ( x , y , atol = self . _threshold , rtol = self . _threshold ) : print ( 'Failure in checking device option {}' ' and output {}. The outputs are:' . format ( i , blobs_to_check [ j ] ) ) print ( x . flatten ( ) ) print ( y . flatten ( ) ) print ( np . max ( np . abs ( x - y ) ) ) success = False # else: #     print ('Passed device pair (%d, %d), %s %s: %s' % #            (i, j, blobs_to_check[j], y.shape, #             str(y.flatten()))) workspace . SwitchWorkspace ( old_ws_name ) return success