(boundary=2.0, number_grid=50, dim_latent=2)
return ObjectBlob(z_grid=z_grid, dim_grid=dim_grid)
Helper function making 1D or 2D grid for evaluation purpose.
Helper function making 1D or 2D grid for evaluation purpose.
Helper function making 1D or 2D grid for evaluation purpose .
def make_grid(boundary=2.0, number_grid=50, dim_latent=2):
  """Helper function making 1D or 2D grid for evaluation purpose."""
  zs = np.linspace(-boundary, boundary, number_grid)
  z_grid = []
  if dim_latent == 1:
    for x in range(number_grid):
      z_grid.append([zs[x]])
    dim_grid = 1
  else:
    for x in range(number_grid):
      for y in range(number_grid):
        z_grid.append([0.] * (dim_latent - 2) + [zs[x], zs[y]])
    dim_grid = 2
  z_grid = np.array(z_grid)
  return ObjectBlob(z_grid=z_grid, dim_grid=dim_grid)
def make_grid ( boundary = 2.0 , number_grid = 50 , dim_latent = 2 ) : zs = np . linspace ( - boundary , boundary , number_grid ) z_grid = [ ] if dim_latent == 1 : for x in range ( number_grid ) : z_grid . append ( [ zs [ x ] ] ) dim_grid = 1 else : for x in range ( number_grid ) : for y in range ( number_grid ) : z_grid . append ( [ 0. ] * ( dim_latent - 2 ) + [ zs [ x ] , zs [ y ] ] ) dim_grid = 2 z_grid = np . array ( z_grid ) return ObjectBlob ( z_grid = z_grid , dim_grid = dim_grid )