当前位置: 首页>>代码示例>>Java>>正文


Java Pointer.memcpy方法代码示例

本文整理汇总了Java中org.bytedeco.javacpp.Pointer.memcpy方法的典型用法代码示例。如果您正苦于以下问题:Java Pointer.memcpy方法的具体用法?Java Pointer.memcpy怎么用?Java Pointer.memcpy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bytedeco.javacpp.Pointer的用法示例。


在下文中一共展示了Pointer.memcpy方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: compressPointer

import org.bytedeco.javacpp.Pointer; //导入方法依赖的package包/类
@Override
protected CompressedDataBuffer compressPointer(DataBuffer.TypeEx srcType, Pointer srcPointer, int length,
                int elementSize) {

    CompressionDescriptor descriptor = new CompressionDescriptor();
    descriptor.setCompressionType(getCompressionType());
    descriptor.setOriginalLength(length * elementSize);
    descriptor.setCompressionAlgorithm(getDescriptor());
    descriptor.setOriginalElementSize(elementSize);
    descriptor.setCompressedLength(length * elementSize);
    descriptor.setNumberOfElements(length);

    BytePointer ptr = new BytePointer(length * elementSize);

    // this Pointer.memcpy is used intentionally. This method operates on host memory ALWAYS
    Pointer.memcpy(ptr, srcPointer, length * elementSize);

    CompressedDataBuffer buffer = new CompressedDataBuffer(ptr, descriptor);

    return buffer;
}
 
开发者ID:deeplearning4j,项目名称:nd4j,代码行数:22,代码来源:NoOp.java

示例2: unsafeDuplication

import org.bytedeco.javacpp.Pointer; //导入方法依赖的package包/类
/**
 * This method does direct array copy. Impossible to use on views or mixed orders.
 *
 * PLEASE NOTE: YOU SHOULD NEVER USE THIS METHOD, UNLESS YOU 100% CLEAR ABOUT IT
 *
 * @return
 */
@Override
public INDArray unsafeDuplication() {
    if (isView())
        return this.dup(this.ordering());

    DataBuffer rb = Nd4j.getMemoryManager().getCurrentWorkspace() == null ? Nd4j.getDataBufferFactory().createSame(this.data, false) : Nd4j.getDataBufferFactory().createSame(this.data, false, Nd4j.getMemoryManager().getCurrentWorkspace());

    INDArray ret = Nd4j.createArrayFromShapeBuffer(rb, this.shapeInfoDataBuffer());

    Pointer.memcpy(ret.data().addressPointer(), this.data().addressPointer(), this.data().length() * this.data().getElementSize());

    return ret;
}
 
开发者ID:deeplearning4j,项目名称:nd4j,代码行数:21,代码来源:NDArray.java

示例3: dup

import org.bytedeco.javacpp.Pointer; //导入方法依赖的package包/类
@Override
public DataBuffer dup() {
    Pointer nPtr = new BytePointer(compressionDescriptor.getCompressedLength());
    Pointer.memcpy(nPtr, pointer, compressionDescriptor.getCompressedLength());
    CompressionDescriptor nDesc = compressionDescriptor.clone();

    CompressedDataBuffer nBuf = new CompressedDataBuffer(nPtr, nDesc);
    return nBuf;
}
 
开发者ID:deeplearning4j,项目名称:nd4j,代码行数:10,代码来源:CompressedDataBuffer.java

示例4: memcpy

import org.bytedeco.javacpp.Pointer; //导入方法依赖的package包/类
@Override
public void memcpy(DataBuffer dstBuffer, DataBuffer srcBuffer) {
    Pointer.memcpy(dstBuffer.addressPointer(), srcBuffer.addressPointer(),
                    srcBuffer.length() * srcBuffer.getElementSize());
}
 
开发者ID:deeplearning4j,项目名称:nd4j,代码行数:6,代码来源:BasicMemoryManager.java


注:本文中的org.bytedeco.javacpp.Pointer.memcpy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。