parameters: (t)
return_statement: return A
docstring: tensor data to np.array
docstring_summary: tensor data to np.array
docstring_tokens: tensor data to np . array
function: def tensor_data_to_np_array(t): # type: tensor_pb2.TensorProto
      """tensor data to np.array
      """
      if t.data.type is tensor_pb2.STR:
          A = np.array(t.data.s[:])
      elif t.data.type is tensor_pb2.INT32:
          A = np.array(t.data.i[:])
      elif t.data.type is tensor_pb2.INT8:
          assert type(t.data.c) is bytes
          A = np.frombuffer(t.data.c, dtype=np.uint8)
      elif t.data.type in [tensor_pb2.FLOAT16, tensor_pb2.FLOAT, tensor_pb2.DOUBLE]:
          A = np.array(t.data.f[:])
      elif t.data.type is tensor_pb2.BOOLEN:
          A = np.array(t.data.b[:])
      else:
          raise Exception('unsupported data_type={}'.format(t.data.type))
  
      A.reshape(t.shape.dim.value)
  
      return A
function_tokens: def tensor_data_to_np_array ( t ) : # type: tensor_pb2.TensorProto if t . data . type is tensor_pb2 . STR : A = np . array ( t . data . s [ : ] ) elif t . data . type is tensor_pb2 . INT32 : A = np . array ( t . data . i [ : ] ) elif t . data . type is tensor_pb2 . INT8 : assert type ( t . data . c ) is bytes A = np . frombuffer ( t . data . c , dtype = np . uint8 ) elif t . data . type in [ tensor_pb2 . FLOAT16 , tensor_pb2 . FLOAT , tensor_pb2 . DOUBLE ] : A = np . array ( t . data . f [ : ] ) elif t . data . type is tensor_pb2 . BOOLEN : A = np . array ( t . data . b [ : ] ) else : raise Exception ( 'unsupported data_type={}' . format ( t . data . type ) ) A . reshape ( t . shape . dim . value ) return A