code: def replace_negative_size_with_batch_size(shape, batch_size):
      
      sl = []
      for d in shape.dim:
          if d < 0:
              # Negative size means batch size
              sl.append(batch_size)
          else:
              sl.append(d)
      out_shape = nnabla_pb2.Shape()
      out_shape.dim.extend(sl)
      return out_shape
docs: Replace all dimensions with negative values to batch size