Introduce Matrix<short>.
This commit is contained in:
Родитель
15e9cf8e94
Коммит
90079c6fa3
|
@ -223,4 +223,4 @@
|
|||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets" />
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
|
@ -652,6 +652,8 @@ void MELScript<ElemType>::CallFunction(const std::string& p_name, const ConfigPa
|
|||
}
|
||||
auto pParamNode = std::dynamic_pointer_cast<LearnableParameter<ElemType>>(pNode);
|
||||
|
||||
//shared_ptr<LearnableParameter<short>> pLearnaParamShort(new LearnableParameter<short>(-1, L"Some_Name"));
|
||||
|
||||
wstring quantizedNodeName = pNode->NodeName() + L"_quantized";
|
||||
// Quantization to <short> is the only currently supported
|
||||
shared_ptr<SymmetricQuantizer<ElemType, short>> quantizer(new SymmetricQuantizer<ElemType, short>(pParamNode->Value().Data(), pParamNode->Value().GetNumElements(), extraBits));
|
||||
|
|
|
@ -6402,6 +6402,28 @@ template char* CPUMatrix<char>::CopyToArray(void) const;
|
|||
template void CPUMatrix<char>::CopySection(size_t numRows, size_t numCols, char* dst, size_t colStride) const;
|
||||
template void CPUMatrix<char>::Reshape(const size_t, const size_t);
|
||||
|
||||
// Support <short>
|
||||
template CPUMatrix<short>::CPUMatrix(const size_t numRows, const size_t numCols);
|
||||
template CPUMatrix<short>::CPUMatrix(const size_t numRows, const size_t numCols, short* pArray, const size_t matrixFlags);
|
||||
template CPUMatrix<short>::CPUMatrix();
|
||||
template CPUMatrix<short>::CPUMatrix(CPUMatrix<short> const&);
|
||||
template CPUMatrix<short>::CPUMatrix(CPUMatrix<short>&&);
|
||||
template size_t CPUMatrix<short>::LocateElement(size_t, size_t) const;
|
||||
template CPUMatrix<short>::~CPUMatrix();
|
||||
template CPUMatrix<short> CPUMatrix<short>::ColumnSlice(size_t startColumn, size_t numCols) const;
|
||||
template CPUMatrix<short>& CPUMatrix<short>::operator=(CPUMatrix<short>&&);
|
||||
template void CPUMatrix<short>::SetValue(const short);
|
||||
template void CPUMatrix<short>::SetValue(const size_t numRows, const size_t numCols, short* pArray, size_t matrixFlags);
|
||||
template void CPUMatrix<short>::SetValue(CPUMatrix<short> const&);
|
||||
//template void CPUMatrix<short>::SetValue(GPUMatrix<short> const&);
|
||||
//template void CPUMatrix<short>::SetValue(CPUSparseMatrix<short> const&);
|
||||
//template void CPUMatrix<short>::SetValue(GPUSparseMatrix<short> const&);
|
||||
template void CPUMatrix<short>::RequireSize(const size_t numRows, const size_t numCols, bool growOnly);
|
||||
template void CPUMatrix<short>::Resize(const size_t numRows, const size_t numCols, bool growOnly);
|
||||
template short* CPUMatrix<short>::CopyToArray(void) const;
|
||||
template void CPUMatrix<short>::CopySection(size_t numRows, size_t numCols, short* dst, size_t colStride) const;
|
||||
template void CPUMatrix<short>::Reshape(const size_t, const size_t);
|
||||
|
||||
template CPUMatrix<int>::CPUMatrix(const size_t, const size_t, int*, const size_t);
|
||||
template CPUMatrix<int>::~CPUMatrix();
|
||||
|
||||
|
|
|
@ -1475,6 +1475,29 @@ template CPUMatrix<char> CPUSparseMatrix<char>::CopyColumnSliceToDense(size_t st
|
|||
template void CPUSparseMatrix<char>::AssignColumnSliceToDense(CPUMatrix<char>&, size_t startColumn, size_t numCols) const;
|
||||
template CPUSparseMatrix<char>& CPUSparseMatrix<char>::operator=(const CPUSparseMatrix<char>& deepCopyFrom);
|
||||
|
||||
// Support <short>
|
||||
template CPUSparseMatrix<short>::CPUSparseMatrix(const MatrixFormat format, const size_t numRows, const size_t numCols, const size_t size);
|
||||
template CPUSparseMatrix<short>::CPUSparseMatrix(MatrixFormat);
|
||||
template CPUSparseMatrix<short>::CPUSparseMatrix(CPUSparseMatrix<short> const&);
|
||||
template CPUSparseMatrix<short>::CPUSparseMatrix(CPUSparseMatrix<short>&&);
|
||||
template CPUSparseMatrix<short>& CPUSparseMatrix<short>::operator=(CPUSparseMatrix<short>&& moveFrom);
|
||||
template void CPUSparseMatrix<short>::SetValue(size_t, size_t, short);
|
||||
//template void CPUSparseMatrix<short>::SetValue(CPUMatrix<short> const&);
|
||||
//template void CPUSparseMatrix<short>::SetValue(GPUMatrix<short> const&);
|
||||
template void CPUSparseMatrix<short>::SetValue(CPUSparseMatrix<short> const&);
|
||||
//template void CPUSparseMatrix<short>::SetValue(GPUSparseMatrix<short> const&);
|
||||
template short* CPUSparseMatrix<short>::Data() const;
|
||||
template short* CPUSparseMatrix<short>::Data();
|
||||
template void CPUSparseMatrix<short>::Reset(void);
|
||||
template void CPUSparseMatrix<short>::Resize(const size_t, const size_t, const size_t, const bool);
|
||||
template void CPUSparseMatrix<short>::RequireSizeAndAllocate(const size_t, const size_t, const size_t, const bool, bool);
|
||||
template void CPUSparseMatrix<short>::RequireSizeAndAllocate(const size_t, const size_t, const size_t, const MatrixFormat, const bool, bool);
|
||||
template CPUSparseMatrix<short>::~CPUSparseMatrix();
|
||||
template CPUSparseMatrix<short> CPUSparseMatrix<short>::ColumnSlice(size_t startColumn, size_t numCols) const;
|
||||
template CPUMatrix<short> CPUSparseMatrix<short>::CopyColumnSliceToDense(size_t startColumn, size_t numCols) const;
|
||||
template void CPUSparseMatrix<short>::AssignColumnSliceToDense(CPUMatrix<short>&, size_t startColumn, size_t numCols) const;
|
||||
template CPUSparseMatrix<short>& CPUSparseMatrix<short>::operator=(const CPUSparseMatrix<short>& deepCopyFrom);
|
||||
|
||||
template CPUSparseMatrix<int>::CPUSparseMatrix(const MatrixFormat, const size_t, const size_t, const size_t);
|
||||
template CPUSparseMatrix<int>::~CPUSparseMatrix();
|
||||
|
||||
|
|
|
@ -4510,24 +4510,50 @@ template void GPUMatrix<char>::SetValue(const size_t numRows, const size_t numCo
|
|||
template void GPUMatrix<char>::SetValue(GPUMatrix<char> const&);
|
||||
//template void GPUMatrix<char>::SetValue(CPUSparseMatrix<char> const&);
|
||||
//template void GPUMatrix<char>::SetValue(GPUSparseMatrix<char> const&);
|
||||
|
||||
template void GPUMatrix<char>::CopySection(size_t numRows, size_t numCols, char* dst, size_t colStride) const;
|
||||
template void GPUMatrix<char>::Reshape(const size_t, const size_t);
|
||||
template GPUMatrix<char>& GPUMatrix<char>::operator*=(char);
|
||||
template DEVICEID_TYPE GPUMatrix<char>::PrepareDevice(DEVICEID_TYPE deviceId) const;
|
||||
|
||||
// Support <short>
|
||||
template GPUMatrix<short>::GPUMatrix(const size_t numRows, const size_t numCols, int deviceId);
|
||||
template GPUMatrix<short>::GPUMatrix(const size_t numRows, const size_t numCols, int deviceId, short* pArray, const size_t matrixFlags);
|
||||
template GPUMatrix<short>::GPUMatrix(const GPUMatrix<short>&);
|
||||
template GPUMatrix<short>::GPUMatrix(GPUMatrix<short>&&);
|
||||
template short* GPUMatrix<short>::CopyToArray() const;
|
||||
template void GPUMatrix<short>::ChangeDeviceTo(int);
|
||||
template void GPUMatrix<short>::Resize(size_t, size_t, bool);
|
||||
template void GPUMatrix<short>::RequireSize(size_t, size_t, bool);
|
||||
|
||||
template GPUMatrix<short>::~GPUMatrix();
|
||||
template GPUMatrix<short> GPUMatrix<short>::ColumnSlice(size_t startColumn, size_t numCols) const;
|
||||
template GPUMatrix<short>& GPUMatrix<short>::operator=(GPUMatrix<short>&&);
|
||||
template GPUMatrix<short>::GPUMatrix(int);
|
||||
template void GPUMatrix<short>::SetValue(const short);
|
||||
template void GPUMatrix<short>::SetValue(const size_t numRows, const size_t numCols, int deviceId, short* pArray, size_t matrixFlags);
|
||||
//template void GPUMatrix<short>::SetValue(CPUMatrix<short> const&);
|
||||
template void GPUMatrix<short>::SetValue(GPUMatrix<short> const&);
|
||||
//template void GPUMatrix<short>::SetValue(CPUSparseMatrix<short> const&);
|
||||
//template void GPUMatrix<short>::SetValue(GPUSparseMatrix<short> const&);
|
||||
template void GPUMatrix<short>::CopySection(size_t numRows, size_t numCols, short* dst, size_t colStride) const;
|
||||
template void GPUMatrix<short>::Reshape(const size_t, const size_t);
|
||||
template GPUMatrix<short>& GPUMatrix<short>::operator*=(short);
|
||||
template DEVICEID_TYPE GPUMatrix<short>::PrepareDevice(DEVICEID_TYPE deviceId) const;
|
||||
|
||||
template GPUMatrix<int>::GPUMatrix(const size_t, const size_t, int, int*, const size_t);
|
||||
template GPUMatrix<int>::~GPUMatrix();
|
||||
|
||||
template int* TracingGPUMemoryAllocator::Allocate<int>(int, size_t);
|
||||
template size_t* TracingGPUMemoryAllocator::Allocate<size_t>(int, size_t);
|
||||
template long* TracingGPUMemoryAllocator::Allocate<long>(int, size_t);
|
||||
template short* TracingGPUMemoryAllocator::Allocate<short>(int, size_t);
|
||||
template char* TracingGPUMemoryAllocator::Allocate<char>(int, size_t);
|
||||
template float* TracingGPUMemoryAllocator::Allocate<float>(int, size_t);
|
||||
template double* TracingGPUMemoryAllocator::Allocate<double>(int, size_t);
|
||||
|
||||
template void TracingGPUMemoryAllocator::Free<int>(int, int*, bool);
|
||||
template void TracingGPUMemoryAllocator::Free<size_t>(int, size_t*, bool);
|
||||
template void TracingGPUMemoryAllocator::Free<short>(int, short*, bool);
|
||||
template void TracingGPUMemoryAllocator::Free<char>(int, char*, bool);
|
||||
template void TracingGPUMemoryAllocator::Free<float>(int, float*, bool);
|
||||
template void TracingGPUMemoryAllocator::Free<double>(int, double*, bool);
|
||||
|
|
|
@ -2699,6 +2699,30 @@ template GPUSparseMatrix<char>& GPUSparseMatrix<char>::operator=(GPUSparseMatrix
|
|||
template void GPUSparseMatrix<char>::Reshape(const size_t, const size_t);
|
||||
template void GPUSparseMatrix<char>::ScaleAndAdd(char, GPUSparseMatrix<char> const &, GPUMatrix<char> &);
|
||||
|
||||
// Support <short>
|
||||
template GPUSparseMatrix<short>::GPUSparseMatrix(DEVICEID_TYPE, const MatrixFormat);
|
||||
template GPUSparseMatrix<short>::GPUSparseMatrix(const size_t, const size_t, const size_t, DEVICEID_TYPE, const MatrixFormat);
|
||||
template GPUSparseMatrix<short>::GPUSparseMatrix(GPUSparseMatrix<short> const&);
|
||||
template GPUSparseMatrix<short>::GPUSparseMatrix(GPUSparseMatrix<short>&&);
|
||||
template void GPUSparseMatrix<short>::SetValue(CPUSparseMatrix<short> const&);
|
||||
template void GPUSparseMatrix<short>::SetValue(GPUSparseMatrix<short> const&);
|
||||
template void GPUSparseMatrix<short>::SetValue(GPUMatrix<short> const&);
|
||||
//template void GPUSparseMatrix<short>::SetValue(CPUMatrix<short> const&);
|
||||
template void GPUSparseMatrix<short>::CopyToDenseMatrix(GPUMatrix<short>&) const;
|
||||
template void GPUSparseMatrix<short>::CopyToCPUSparseMatrix(CPUSparseMatrix<short>&) const;
|
||||
template void GPUSparseMatrix<short>::ChangeDeviceTo(int);
|
||||
template void GPUSparseMatrix<short>::Resize(const size_t, const size_t, const size_t, const bool);
|
||||
template void GPUSparseMatrix<short>::RequireSizeAndAllocate(const size_t, const size_t, const size_t, const bool, const bool);
|
||||
template void GPUSparseMatrix<int>::RequireSizeAndAllocate(const size_t, const size_t, const size_t, const bool, const bool);
|
||||
template void GPUSparseMatrix<short>::Reset();
|
||||
template GPUSPARSE_INDEX_TYPE GPUSparseMatrix<short>::SecondaryIndexValueAt(size_t) const;
|
||||
template GPUSparseMatrix<short>::~GPUSparseMatrix();
|
||||
template GPUSparseMatrix<short> GPUSparseMatrix<short>::ColumnSlice(size_t, size_t) const;
|
||||
template GPUMatrix<short> GPUSparseMatrix<short>::CopyColumnSliceToDense(size_t, size_t) const;
|
||||
template GPUSparseMatrix<short>& GPUSparseMatrix<short>::operator=(GPUSparseMatrix<short>&&);
|
||||
template void GPUSparseMatrix<short>::Reshape(const size_t, const size_t);
|
||||
template void GPUSparseMatrix<short>::ScaleAndAdd(short, GPUSparseMatrix<short> const &, GPUMatrix<short> &);
|
||||
|
||||
template GPUSparseMatrix<int>::GPUSparseMatrix(DEVICEID_TYPE, const MatrixFormat);
|
||||
template GPUSparseMatrix<int>::~GPUSparseMatrix();
|
||||
|
||||
|
|
|
@ -1140,6 +1140,11 @@ template <>
|
|||
{
|
||||
return 0;
|
||||
} // (needed for completeness)
|
||||
template <>
|
||||
/*static*/ short Matrix<short>::MakeNan(size_t)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <class ElemType>
|
||||
void Matrix<ElemType>::MaskColumnsValue(const Matrix<char>& columnsMask, ElemType val)
|
||||
|
@ -5431,6 +5436,31 @@ template void Matrix<char>::Resize(const size_t numRows, const size_t numCols, c
|
|||
template void Matrix<char>::Reshape(const size_t, const size_t);
|
||||
template char* Matrix<char>::CopyToArray(void) const;
|
||||
|
||||
// Matrix<short> methods
|
||||
template Matrix<short>::Matrix(DEVICEID_TYPE);
|
||||
template Matrix<short>::Matrix(Matrix<short>&&);
|
||||
template Matrix<short>::Matrix(const size_t numRows, const size_t numCols, DEVICEID_TYPE deviceId, const MatrixType matrixType, const MatrixFormat matrixFormat);
|
||||
template Matrix<short>::Matrix(const size_t numRows, const size_t numCols, short* pArray, DEVICEID_TYPE deviceId, const size_t matrixFlags, const size_t nnz);
|
||||
template Matrix<short>::~Matrix();
|
||||
template Matrix<short>& Matrix<short>::operator=(Matrix<short>&& moveFrom);
|
||||
template short* Matrix<short>::Data() const;
|
||||
template int Matrix<short>::GetDeviceId() const;
|
||||
template size_t Matrix<short>::GetNumElements() const;
|
||||
template Matrix<short> Matrix<short>::ColumnSlice(size_t startColumn, size_t numCols) const;
|
||||
template void Matrix<short>::_transferToDevice(int id_to, bool isBeingMoved, bool emptyTransfer) const;
|
||||
template void Matrix<short>::TransferToDeviceIfNotThere(int id_to, bool isBeingMoved, bool emptyTransfer, bool updatePreferredDevice) const;
|
||||
template size_t Matrix<short>::GetNumRows() const;
|
||||
template size_t Matrix<short>::GetNumCols() const;
|
||||
template void Matrix<short>::SetValue(const short);
|
||||
template void Matrix<short>::SetValue(size_t numRows, const size_t numCols, int deviceId, short* pArray, size_t matrixFlags);
|
||||
//template void Matrix<short>::SetValue(const Matrix<short>&, MatrixFormat);
|
||||
template void Matrix<short>::SetValue(const Matrix<short>&);
|
||||
template void Matrix<short>::AssignValuesOf(const Matrix<short>&);
|
||||
template bool Matrix<short>::IsEmpty() const;
|
||||
template void Matrix<short>::Resize(const size_t numRows, const size_t numCols, const size_t numNZElemToReserve, bool growOnly);
|
||||
template void Matrix<short>::Reshape(const size_t, const size_t);
|
||||
template short* Matrix<short>::CopyToArray(void) const;
|
||||
|
||||
template Matrix<int>::Matrix(const size_t, const size_t, int*, DEVICEID_TYPE, const size_t, const size_t);
|
||||
|
||||
}}}
|
||||
|
|
|
@ -708,6 +708,7 @@ void GPUSparseMatrix<ElemType>::ConvertBuffer(OutType* outBuffer, const InType*
|
|||
|
||||
#pragma endregion Helper Functions
|
||||
|
||||
template class MATH_API GPUSparseMatrix<short>;
|
||||
template class MATH_API GPUSparseMatrix<char>;
|
||||
template class MATH_API GPUSparseMatrix<float>;
|
||||
template class MATH_API GPUSparseMatrix<double>;
|
||||
|
@ -2216,6 +2217,7 @@ GPURNGHandle::GPURNGHandle(int deviceId, unsigned long seed)
|
|||
|
||||
#pragma endregion GPURNGHandle functions
|
||||
|
||||
template class GPUMatrix<short>;
|
||||
template class GPUMatrix<char>;
|
||||
template class GPUMatrix<float>;
|
||||
template class GPUMatrix<double>;
|
||||
|
|
Загрузка…
Ссылка в новой задаче