void WebGLTexture::ImageInfo::Clear() { if (!IsDefined()) return; OnRespecify(); Mutable(mFormat) = LOCAL_GL_NONE; Mutable(mWidth) = 0; Mutable(mHeight) = 0; Mutable(mDepth) = 0; MOZ_ASSERT(!IsDefined()); }
void WebGLTexture::ImageInfo::Set(const char* funcName, const ImageInfo& a) { MOZ_ASSERT(a.IsDefined()); Mutable(mFormat) = a.mFormat; Mutable(mWidth) = a.mWidth; Mutable(mHeight) = a.mHeight; Mutable(mDepth) = a.mDepth; mIsDataInitialized = a.mIsDataInitialized; // But *don't* transfer mAttachPoints! MOZ_ASSERT(a.mAttachPoints.empty()); OnRespecify(funcName); }
WebGLTexture::ImageInfo& WebGLTexture::ImageInfo::operator =(const ImageInfo& a) { MOZ_ASSERT(a.IsDefined()); Mutable(mFormat) = a.mFormat; Mutable(mWidth) = a.mWidth; Mutable(mHeight) = a.mHeight; Mutable(mDepth) = a.mDepth; mIsDataInitialized = a.mIsDataInitialized; // But *don't* transfer mAttachPoints! MOZ_ASSERT(a.mAttachPoints.empty()); OnRespecify(); return *this; }
Waifu2x::eWaifu2xError Waifu2x::SetParameter(caffe::NetParameter ¶m) const { param.mutable_state()->set_phase(caffe::TEST); { auto mid = param.mutable_input_dim(); if (mid->size() != 4) return eWaifu2xError_FailedParseModelFile; *mid->Mutable(0) = batch_size; *mid->Mutable(2) = input_block_size; *mid->Mutable(3) = input_block_size; } for (int i = 0; i < param.layer_size(); i++) { caffe::LayerParameter *layer_param = param.mutable_layer(i); const std::string& type = layer_param->type(); if (type == "Convolution") { if (process == "cudnn") layer_param->mutable_convolution_param()->set_engine(caffe::ConvolutionParameter_Engine_CUDNN); else layer_param->mutable_convolution_param()->set_engine(caffe::ConvolutionParameter_Engine_CAFFE); } else if (type == "ReLU") { if (process == "cudnn") layer_param->mutable_relu_param()->set_engine(caffe::ReLUParameter_Engine_CUDNN); else layer_param->mutable_relu_param()->set_engine(caffe::ReLUParameter_Engine_CAFFE); } } return eWaifu2xError_OK; }