Ejemplo n.º 1
0
 // TODO: This could actually be strided?
 const char* NDMask::DataBuffer() const
 {
     // First make sure that the underlying matrix is on the right device
     auto matrix = GetMatrix();
     matrix->TransferToDeviceIfNotThere(AsCNTKImplDeviceId(m_device), true);
     return matrix->Data();
 }
Ejemplo n.º 2
0
    const ElementType* NDArrayView::DataBuffer() const
    {
        if (AsDataType<ElementType>() != m_dataType)
            LogicError("The specified ElementType %s does not match the DataType %s", typeid(ElementType).name(), DataTypeName(m_dataType));

        if (IsSparse())
            InvalidArgument("DataBuffer/WritableDataBuffer methods can only be called for NDArrayiew objects with dense storage format");

        // First make sure that the underlying matrix is on the right device
        auto matrix = GetMatrix<ElementType>();
        matrix->TransferToDeviceIfNotThere(AsCNTKImplDeviceId(m_device), true);
        return matrix->Data();
    }