本文整理汇总了Java中water.util.UnsafeUtils.set4f方法的典型用法代码示例。如果您正苦于以下问题:Java UnsafeUtils.set4f方法的具体用法?Java UnsafeUtils.set4f怎么用?Java UnsafeUtils.set4f使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类water.util.UnsafeUtils
的用法示例。
在下文中一共展示了UnsafeUtils.set4f方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bufD
import water.util.UnsafeUtils; //导入方法依赖的package包/类
private byte[] bufD(final int valsz, boolean na_sparse){
int elem_size = valsz+4;
byte [] res = MemoryManager.malloc1(CXIChunk._OFF + _sparseLen*elem_size);
UnsafeUtils.set4(res,0,_len);
res[4] = (byte)4;
res[5] = (byte)valsz;
res[6] = na_sparse?(byte)1:0;
if(na_sparse)res[6] = (byte)1;
for(int i = 0; i < _sparseLen; ++i){
UnsafeUtils.set4(res,CXIChunk._OFF+i*elem_size+0,_id[i]);
if(valsz == 4){
UnsafeUtils.set4f(res,CXIChunk._OFF+i*elem_size+4,(float)_ds[i]);
} else if(valsz == 8) {
UnsafeUtils.set8d(res,CXIChunk._OFF+i*elem_size+4,_ds[i]);
} else throw H2O.unimpl();
}
return res;
}
示例2: compute2
import water.util.UnsafeUtils; //导入方法依赖的package包/类
synchronized
@Override
public void compute2() {
_destLabel[_index] = _label;
final int start=_index* _wordsPerLine;
Key txtKey = Key.make("line_" + _globalId + DeepWaterModel.CACHE_MARKER);
boolean status = false;
if (_cache) { //try to get the data from cache first
C4FChunk icedTxt = DKV.getGet(txtKey);
if (icedTxt != null) {
// place the cached txt into the right minibatch slot
for (int i=0; i<icedTxt._len; ++i)
_destData[start+i] = (float)icedTxt.atd(i);
status = true;
}
}
if (!status) {
int[] data = StringUtils.tokensToArray(StringUtils.tokenize(_text), _wordsPerLine, DeepWaterTextIterator.getDict());
// System.err.println(Arrays.toString(data));
for (int i = 0; i< _wordsPerLine; ++i) {
_destData[start + i] = (float)data[i];
}
if (_cache) {
byte[] mem = new byte[_wordsPerLine *4];
for (int i = 0; i< _wordsPerLine; ++i)
UnsafeUtils.set4f(mem,i<<2, _destData[start + i]);
Value v = new Value(txtKey,new C4FChunk(mem));
DKV.put(txtKey, v);
v.freeMem();
}
}
tryComplete();
}
示例3: set_impl
import water.util.UnsafeUtils; //导入方法依赖的package包/类
@Override boolean set_impl(int i, float f ) {
UnsafeUtils.set4f(_mem,i<<2,f);
return true;
}
示例4: setNA_impl
import water.util.UnsafeUtils; //导入方法依赖的package包/类
@Override boolean setNA_impl(int idx) { UnsafeUtils.set4f(_mem,(idx<<2),Float.NaN); return true; }