def _nodef_to_numpy_array(x):
    'Map a NodeDef x to a np.array.'
    dtype = x.attr['dtype'].type
    x_shape = [i.size for i in x.attr['value'].tensor.tensor_shape.dim]
    if (dtype == tf.float32):
        nums = array.array('f', x.attr['value'].tensor.tensor_content)
    elif (dtype == tf.float64):
        nums = array.array('d', x.attr['value'].tensor.tensor_content)
    elif (dtype == tf.int32):
        nums = array.array('i', x.attr['value'].tensor.tensor_content)
    else:
        raise TypeError('Unsupported dtype')
    return np.array(nums).reshape(x_shape)
Map a NodeDef x to a np.array.
def _nodef_to_numpy_array(x):
    
    dtype = x.attr['dtype'].type
    x_shape = [i.size for i in x.attr['value'].tensor.tensor_shape.dim]
    if (dtype == tf.float32):
        nums = array.array('f', x.attr['value'].tensor.tensor_content)
    elif (dtype == tf.float64):
        nums = array.array('d', x.attr['value'].tensor.tensor_content)
    elif (dtype == tf.int32):
        nums = array.array('i', x.attr['value'].tensor.tensor_content)
    else:
        raise TypeError('Unsupported dtype')
    return np.array(nums).reshape(x_shape)