water.Value.<init>()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(102)

本文整理了Java中water.Value.<init>()方法的一些代码示例,展示了Value.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Value.<init>()方法的具体详情如下:
包路径:water.Value
类名称:Value
方法名:<init>

Value.<init>介绍

暂无

代码示例

代码示例来源:origin: h2oai/h2o-2

@Override public Value makeValue( Object key, byte[] bits ) { return new Value((Key)key,bits); }
@Override public void put( Object key, Object val ) { UKV.put((Key)key,(Value)val); }

代码示例来源:origin: h2oai/h2o-2

static public Value put( Key key, Iced v, Futures fs ) {
 return put(key,new Value(key,v),fs);
}
static public Value put( Key key, Iced v, Futures fs,boolean donCache ) {

代码示例来源:origin: h2oai/h2o-2

static public Value put( Key key, Iced v, Futures fs,boolean donCache ) {
 return put(key,new Value(key,v),fs,donCache);
}

代码示例来源:origin: h2oai/h2o-2

static public void put( Key key, Iced val, Futures fs ) { put(key,new Value(key, val),fs); }
// Do the DKV.put.  DISALLOW this interface for Lockables.  Lockables all

代码示例来源:origin: h2oai/h2o-2

private void loadExisting(File f) {
 for( File c : f.listFiles() ) {
  if( c.isDirectory() ) {
   loadExisting(c); // Recursively keep loading K/V pairs
  } else {
   Key k = str2Key(c.getName());
   Value ice = new Value(k, (int) c.length());
   ice.setdsk();
   H2O.putIfAbsent_raw(k, ice);
  }
 }
}

代码示例来源:origin: h2oai/h2o-2

static public void put( Key key, Iced fr ) {
 if( fr == null ) UKV.remove(key);
 else UKV.put(key,new Value(key, fr));
}

代码示例来源:origin: h2oai/h2o-2

static public void put( Key key, Freezable fr ) {
 if( fr == null ) UKV.remove(key);
 else UKV.put(key,new Value(key, fr));
}

代码示例来源:origin: h2oai/h2o-2

public MapReduce(Layer[] ls, double epochs, Key job) {
 _ls = ls;
 _epochs = epochs;
 _job = job;
 _key = Key.make((byte) 1, Key.DFJ_INTERNAL_USER, H2O.SELF);
 _instances.put(_key, this);
 DKV.put(_key, new Value(_key, new byte[0]));
 Vec[] vecs = ((VecsInput) ls[0]).vecs;
 assert ls[0]._a.length == VecsInput.expand(vecs);
 //assert vecs[0].nChunks() >= NeuralNet.cores() : "Not enough chunks, c.f. NeuralNet.reChunk";
 _counts = new AtomicIntegerArray(vecs[0].nChunks());
}

代码示例来源:origin: h2oai/h2o-2

public Key toCompressedKey() {
 AutoBuffer bs = new AutoBuffer();
 TreeModel.CompressedTree compressedTree = compress();
 Key key = Key.make((byte)1,Key.DFJ_INTERNAL_USER, H2O.SELF);
 UKV.put(key, new Value(key, compressedTree));
 return key;
}

代码示例来源:origin: h2oai/h2o-2

@Override protected AutoBuffer postLoad(Model m, AutoBuffer ab) {
  int ntrees = ab.get4();
  Futures fs = new Futures();
  for (int i = 0; i < ntrees; ++i) {
   DKV.put(t_keys[i],new Value(t_keys[i],ab.getA1()), fs);
   for (int j = 0; j < nclasses(); ++j) {
    if (dtreeKeys[i][j] == null) continue;
    UKV.put(dtreeKeys[i][j], new Value(dtreeKeys[i][j], ab.get(DTree.TreeModel.CompressedTree.class)), fs);
   }
  }
  fs.blockForPending();
  return ab;
 }
};

代码示例来源:origin: h2oai/h2o-2

@Override public Value atomic(Value val) {
 T old = val == null ? null : (T)(val.get().clone());
 T nnn = atomic(old);
 // Atomic operation changes the data, so it can not be performed over values persisted on read-only data source
 // as we would not be able to write those changes back.
 assert val == null || val.onICE() || !val.isPersisted();
 return  nnn == null ? null : new Value(_key,nnn,val==null?Value.ICE:(byte)(val._persist&Value.BACKEND_MASK));
}
@Override public void onSuccess( Value old ) { onSuccess(old==null?null:(T)old.get()); }

代码示例来源:origin: h2oai/h2o-2

@Override public void dinvoke( H2ONode sender ) {
 assert !_key.home();        // No point in sending Keys to home
 // Update ONLY if there is not something there already.
 // Update only a bare Value, with no backing data.
 // Real data can be fetched on demand.
 Value val = new Value(_key,_max,null,_type,_be);
 Value old = H2O.raw_get(_key);
 while( old == null && H2O.putIfMatch(_key,val,null) != null )
  old = H2O.raw_get(_key);
 _key = null;                // No return result
 tryComplete();
}  
@Override public void compute2() { throw H2O.unimpl(); }

代码示例来源:origin: h2oai/h2o-2

public static Key loadKey(S3ObjectSummary obj) throws IOException {
 Key k = encodeKey(obj.getBucketName(), obj.getKey());
 long size = obj.getSize();
 Value val = new Value(k, (int) size, Value.S3); // Plain Value
 val.setdsk();
 DKV.put(k, val);
 return k;
}

代码示例来源:origin: h2oai/h2o-2

@Override public Value atomic(Value val) {
  Key.Ary ks = val == null ? new Key.Ary(new Key[0]) : (Key.Ary)val.get();
  Key[] keys = Arrays.copyOf(ks._keys,ks._keys.length+1);
  keys[keys.length-1]=k;
  return new Value(_key,new Key.Ary(keys));
 }
}.invoke(keys);

代码示例来源:origin: h2oai/h2o-2

public Key toKey() {
 AutoBuffer bs = new AutoBuffer();
 bs.put4(_data_id);
 bs.put8(_seed);
 bs.put1(_producerId);
 _tree.write(bs);
 Key key = Key.make((byte)1,Key.DFJ_INTERNAL_USER, H2O.SELF);
 DKV.put(key,new Value(key, bs.buf()));
 return key;
}

代码示例来源:origin: h2oai/h2o-2

@Override public Response serve() {
 JsonObject response = new JsonObject();
 Key k = Key.make(_key.value()._kb, (byte) (int)_rf.value());
 Value v = new Value(k,_value.value().getBytes());
 UKV.put(k,v);
 response.addProperty(KEY,k.toString());
 response.addProperty(REPLICATION_FACTOR,k.desired());
 response.addProperty(VALUE_SIZE,v._max);
 return Response.done(response);
}

代码示例来源:origin: h2oai/h2o-2

@Override public Value atomic( Value val ) {
  byte[] bits1 = val.memOrLoad();
  long l1 = UDP.get8(bits1,0);
  long l2 = UDP.get8(bits1,8);
  l1 += 2;
  l2 += 2;
  byte[] bits2 = new byte[16];
  UDP.set8(bits2,0,l1);
  UDP.set8(bits2,8,l2);
  return new Value(_key,bits2);
 }
}

代码示例来源:origin: h2oai/h2o-2

public static  Key makeByteVec(Key k, String... data) {
 byte [][] chunks = new byte[data.length][];
 long [] espc = new long[data.length+1];
 for(int i = 0; i < chunks.length; ++i){
  chunks[i] = data[i].getBytes();
  espc[i+1] = espc[i] + data[i].length();
 }
 Futures fs = new Futures();
 ByteVec bv = new ByteVec(Vec.newKey(),espc);
 for(int i = 0; i < chunks.length; ++i){
  Key chunkKey = bv.chunkKey(i);
  DKV.put(chunkKey, new Value(chunkKey,chunks[i].length,chunks[i],TypeMap.C1NCHUNK,Value.ICE),fs);
 }
 DKV.put(bv._key,bv,fs);
 Frame fr = new Frame(k,new String[]{"makeByteVec"},new Vec[]{bv});
 DKV.put(k, fr, fs);
 fs.blockForPending();
 return k;
}

代码示例来源:origin: h2oai/h2o-2

@Test public void testRemoteBitSet() throws Exception {
 Scope.enter();
 // Issue a slew of remote key puts
 Key[] keys = new Key[32];
 for( int i = 0; i < keys.length; ++i ) {
  Key k = keys[i] = Key.make("key"+i);
  byte[] bits = new byte[4];
  bits[0] = (byte)i;        // Each value holds a shift-count
  Value val = new Value(k,bits);
  DKV.put(k,val);
 }
 DKV.write_barrier();
 RemoteBitSet r = new RemoteBitSet();
 r.invoke(keys);
 assertEquals((int)((1L<<keys.length)-1), r._x);
 //for( Key k : keys ) DKV.remove(k);
 Scope.exit();
}

代码示例来源:origin: h2oai/h2o-2

@Test public void testBasicCRUD() {
 Key k1 = Key.make("key1");
 Value v0 = DKV.get(k1);
 assertNull(v0);
 Value v1 = new Value(k1,"test0 bits for Value");
 DKV.put(k1,v1);
 assertEquals(v1._key,k1);
 Value v2 = DKV.get(k1);
 assertEquals(v1,v2);
 DKV.remove(k1);
 Value v3 = DKV.get(k1);
 assertNull(v3);
}

相关文章

微信公众号

最新文章

更多