pytorch  1.8.2
About: PyTorch provides Tensor computation (like NumPy) with strong GPU acceleration and Deep Neural Networks (in Python) built on a tape-based autograd system. LTS (Long Term Support) release.
  Fossies Dox: pytorch-1.8.2.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

boolean_mask_ops.cc File Reference
Include dependency graph for boolean_mask_ops.cc:

Go to the source code of this file.

Namespaces

namespace  caffe2
 Copyright (c) 2016-present, Facebook, Inc.
 

Functions

 caffe2::REGISTER_CPU_OPERATOR (BooleanMask, BooleanMaskOp< CPUContext >)
 
 caffe2::REGISTER_CPU_GRADIENT_OPERATOR (BooleanMaskGradient, BooleanMaskOpGradient< CPUContext >)
 
 caffe2::REGISTER_CPU_OPERATOR (BooleanMaskLengths, BooleanMaskLengthsOp< CPUContext >)
 
 caffe2::NumInputs (2) .NumOutputs(1) .SetDoc(R"DOC( Batch Matrix multiplication Yi = Ai * Bi
 
 caffe2::SetDoc (R"DOC( Given a 1D `data` tensor and a boolean `mask` tensor of the same shape, returns a `masked_data` tensor containing only the elements corresponding to positions where the `mask` is True, and a `masked_indices` tensor containing the indices of the True elements. Github Links: - https://github.com/pytorch/pytorch/blob/master/caffe2/operators/boolean_mask_ops.cc <details> <summary> <b>Example</b> </summary> **Code** ``` workspace.ResetWorkspace() op = core.CreateOperator( "BooleanMask", ["data", "mask"], ["masked_data", "masked_indices"] ) workspace.FeedBlob("data", np.array([1,2,3,4,5,6])) workspace.FeedBlob("mask", np.array([True,False,False,True,True,False])) print("data:", workspace.FetchBlob("data")) print("mask:", workspace.FetchBlob("mask")) workspace.RunOperatorOnce(op) print("masked_data:", workspace.FetchBlob("masked_data")) print("masked_indices:", workspace.FetchBlob("masked_indices")) ``` **Result** ``` data: [1 2 3 4 5 6] mask: [ True False False True True False] masked_data: [1 4 5] masked_indices: [0 3 4] ``` </details> )DOC") .Input(0
 
same shape as data caffe2::Output (0, "masked_data", "(*Tensor*): 1D tensor of same type as `data` input that contains the masked input tensor") .Output(1
 
return the segment lengths of the corresponding segmented tensor after **BooleanMask **is applied If lengths tensor is $[a_1, a_2,..., a_n] then length of mask tensor must be $a_1 a_2 a_n$ Github workspace caffe2::FeedBlob ("lengths", np.array([1, 3, 2], dtype=np.int32)) workspace.FeedBlob("mask"
 
return the segment lengths of the corresponding segmented tensor after **BooleanMask **is applied If lengths tensor is $[a_1, a_2,..., a_n] then length of mask tensor must be $a_1 a_2 a_n$ Github workspace np array([False, True, True, False, True, True])) print("lengths caffe2::GRADIENT_OPERATOR_SCHEMA (BooleanMaskGradient).NumInputs(2).NumOutputs(1)
 
template<typename Functor >
void caffe2::MaskWithFunctor (int N, int M, int B, const float *in, Functor fn, float fill_val, float *out)
 
template<typename Functor >
void caffe2::RepeatedMaskWithFunctor (int N, int M, int D, const float *in, Functor fn, float fill_val, float *out)
 
 caffe2::REGISTER_CPU_OPERATOR (SequenceMask, SequenceMaskOp< CPUContext >)
 

Variables

Tensor caffe2::__pad0__
 
Tensor caffe2::mask
 
Tensor caffe2::Tensor
 
same shape as data caffe2::masked_indices
 
return the segment lengths of the corresponding segmented tensor after **BooleanMask **is applied If lengths tensor is $[a_1, a_2,..., a_n] caffe2::$ =1
 
const float caffe2::minf = -1.0f * std::numeric_limits<float>::infinity()
 

Variable Documentation

◆ c

const int* c
private

Definition at line 330 of file boolean_mask_ops.cc.

Referenced by at::__printMatrix(), at::native::_chain_matmul_three_matrices(), at::native::_grid_sampler_2d_cpu_fallback(), at::native::_grid_sampler_2d_cpu_fallback_backward(), _igam_helper_series(), _igamc_helper_continued_fraction(), at::native::_pdist_forward(), at::native::_thnn_differentiable_lstm_cell_backward(), at::native::adaptive_avg_pool2d(), at::native::add_out_sparse_non_contiguous(), at::native::addmm_impl_cpu_(), torch::jit::ConcretePythonOp::autogradFunction(), at::native::vulkan::detail::avg_pool2d(), torch::nn::functions::CrossMapLRN2d::backward(), at::native::batch_norm_cpu_inference_channels_last(), at::native::batch_norm_cpu_inference_collect_linear_and_constant_terms(), at::cuda::blas::bgemm< at::Half >(), at::cuda::blas::bgemm< c10::complex< double > >(), at::cuda::blas::bgemm< c10::complex< float > >(), at::cuda::blas::bgemm< double >(), at::cuda::blas::bgemm< float >(), org.pytorch.torchvision.TensorImageUtils::bitmapToFloatBuffer(), BM_long_static_memory_optimization(), at::native::bmm_out_or_baddbmm_(), calc_erfinv(), calc_gcd(), fake_fp16::CalcSwishByLUTCubic(), fake_fp16::CalcTanhByPolynomial(), at::native::channel_shuffle(), CharacteristicArguments(), at::checkAllContiguous(), at::checkAllDefined(), at::checkAllSame(), at::checkAllSameGPU(), at::checkAllSameNumel(), at::checkAllSameSize(), at::checkAllSameType(), at::checkBackend(), at::checkContiguous(), at::checkDefined(), at::checkDeviceType(), at::checkDim(), at::checkDimRange(), at::checkLayout(), at::checkNumel(), at::checkSameDim(), at::checkSameGPU(), at::checkSameNumel(), at::checkSameSize(), at::checkSameType(), at::checkScalarType(), at::checkScalarTypes(), at::checkSize(), torch::autograd::ForwardGrad::clear(), at::native::col2vol(), torch::jit::fuser::compileKernel(), c10::ivalue::ComplexHolder::ComplexHolder(), qnnpack::compute_q8conv(), compute_q8conv(), qnnpack::compute_q8gemm(), compute_q8gemm(), qnnpack::compute_q8gemm_dq(), compute_q8gemm_prepacked_sparse_dq(), compute_q8gemm_sparse_dq(), qnnpack::compute_q8gemm_xzp(), compute_q8gemm_xzp(), c10::Error::compute_what(), torch::jit::PythonPrintImpl::containsNonASCIIString(), crc32_1byte_tableless2(), Notifier< T >::deleteDestructorCallback(), Notifier< T >::deleteNotificationCallback(), at::native::embedding_sparse_backward(), torch::jit::to_ir::emitConst(), torch::jit::to_ir::emitStringLiteral(), torch::jit::CodeTemplate::emitStringWithIndents(), at::native::end_index(), extendFrozenModules(), c10::ClassType::findConstant(), fp16_fma::float16_muladd(), torch::jit::CodeTemplate::format(), torch::distributed::rpc::PythonCall::fromMessage(), at::native::cpublas::gemm(), at::cuda::blas::gemm< at::Half >(), at::cuda::blas::gemm< c10::complex< double > >(), at::cuda::blas::gemm< c10::complex< float > >(), at::cuda::blas::gemm< double >(), at::cuda::blas::gemm< float >(), GenerateSizes(), GenerateSizes2d(), GenerateSizes4d(), torch::jit::tensorexpr::getAllBufs(), torch::jit::tensorexpr::IfThenElse::IfThenElse(), torch::jit::tensorexpr::ifThenElse(), torch::autograd::generated::details::infinitely_differentiable_native_group_norm_backward(), torch::autograd::generated::details::infinitely_differentiable_native_layer_norm_backward(), torch::jit::initJITBindings(), torch::jit::initTensorExprBindings(), at::native::instance_norm(), torch::jit::is_valid_python_id_char(), torch::jit::isCharCount(), c10::isSubtypeOfList(), torch::jit::isValidIdentifierChar(), c10::IValue::IValue(), JNI_OnLoad(), torch::jit::fuser::launchFusion(), torch::jit::ConcretePythonOp::lint_python(), torch::jit::lower_graph(), main(), torch::jit::tensorexpr::IfThenElse::make(), torch::jit::PythonPrintImpl::makeValidIdentifier(), at::native::vulkan::detail::max_pool2d(), torch::jit::mergeRanges(), torch::jit::tensorexpr::PolynomialTransformer::mulTerms(), torch::jit::tensorexpr::PolynomialTransformer::mutate(), c10::hash< c10::complex< T > >::operator()(), c10::complex< T >::operator*=(), c10::complex< T >::operator/=(), torch::parse_string_literal(), torch::jit::parseOctal(), torch::jit::parseStringLiteral(), at::native::metal::permuteWeights(), at::native::pixel_shuffle(), at::native::pixel_unshuffle(), torch::jit::prefixLine(), fp16_fma::propagateFloat16MulAddNaN(), pytorch_hgemm_ukernel_8x8__neonfp16arith(), pytorch_pack_q8dw_w_dilation(), pytorch_pack_q8dw_wdq(), pytorch_pack_q8dw_wrq(), pytorch_q8conv_ukernel_4x4c2__sse2(), pytorch_q8conv_ukernel_4x8__neon(), pytorch_q8conv_ukernel_8x8__neon(), pytorch_q8dwconv_ukernel_mp8x25__neon(), pytorch_q8dwconv_ukernel_mp8x25__sse2(), pytorch_q8dwconv_ukernel_mp8x25_per_channel__neon(), pytorch_q8dwconv_ukernel_mp8x25_per_channel__sse2(), pytorch_q8dwconv_ukernel_up8x9__neon(), pytorch_q8dwconv_ukernel_up8x9__sse2(), pytorch_q8dwconv_ukernel_up8x9_per_channel__neon(), pytorch_q8dwconv_ukernel_up8x9_per_channel__sse2(), pytorch_q8gemm_dq_sparse_1x4_ukernel_8x4__sse2(), pytorch_q8gemm_dq_sparse_1x4_ukernel_8x4_packedA__sse2(), pytorch_q8gemm_dq_ukernel_4x4c2__sse2(), pytorch_q8gemm_dq_ukernel_4x8__neon(), pytorch_q8gemm_ukernel_2x4c8__sse2(), pytorch_q8gemm_ukernel_4x4c2__sse2(), pytorch_q8gemm_ukernel_4x8__neon(), pytorch_q8gemm_ukernel_6x4__neon(), pytorch_q8gemm_ukernel_8x8__neon(), pytorch_q8gemm_xzp_ukernel_4x8c2__neon(), pytorch_sconv_ukernel_6x8__psimd(), pytorch_sdwconv_ukernel_up4x9__psimd(), pytorch_sgemm_ukernel_5x8__neon(), pytorch_sgemm_ukernel_6x8__neon(), pytorch_sgemm_ukernel_6x8__psimd(), qnnpack::qnnpackConv(), qnnpack::qnnpackLinear(), qnnpack::qnnpackLinearDynamic(), torch::jit::qualifierToArchivePath(), torch::jit::Unpickler::readString(), c10::IValue::repr(), torch::jit::tensorexpr::registerizer::AccessInfo::setConditionId(), sgemmBenchmark(), torch::jit::SharedParserData::SharedParserData(), torch::jit::tensorexpr::simplifyRoundModPattern(), sincos256_ps(), c10::SmallVector< T, N >::SmallVector(), torch::jit::ArgumentSpecCreator::specializeTypes(), at::native::start_index(), tanh_caffe2(), torch::jit::tensorexpr::HashProvider::te_hash(), tensor_add(), TEST(), THFloatVector_fill_NEON(), THFloatVector_muls_NEON(), fbgemm::transpose_4rows(), at::native::upsample_nearest2d_out_frame(), at::native::upsample_nearest3d_out_frame(), torch::jit::tensorexpr::HashProvider::visit(), at::native::vol2col(), torch::jit::fuser::cuda::where(), and torch::distributed::rpc::WorkerInfo::WorkerInfo().

◆ len_

const size_t len_
private

Definition at line 319 of file boolean_mask_ops.cc.

◆ r

const int r
private

Definition at line 331 of file boolean_mask_ops.cc.

Referenced by __PySlice_Unpack(), _igam_helper_series(), _igamc_helper_continued_fraction(), at::native::_local_scalar_dense_cpu(), at::native::_rrelu_with_noise_train(), at::_setTLSCallbacks(), torch::utils::_sparse_coo_tensor_unsafe_ctor(), at::native::_sparse_sum_backward_cpu(), at::native::_sspaddmm_out_cpu(), torch::utils::_validate_sparse_coo_tensor_args(), torch::jit::TreeToken::add(), at::native::add_dense_sparse_worker_cpu(), at::native::add_out_dense_sparse_cpu(), at::native::add_out_sparse_contiguous(), at::native::add_out_sparse_cpu(), at::native::add_out_sparse_non_contiguous(), torch::cuda::nccl::all2all(), torch::cuda::nccl::all2all_single_equal_split(), torch::cuda::nccl::all2all_single_unequal_split(), c10::hip::HIPAllocatorMasqueradingAsCUDA::allocate(), c10::cuda::CUDACachingAllocator::CudaCachingAllocator::allocate(), torch::autograd::PyNode::apply(), at::native::arange_cpu_out(), torch::utils::as_tensor(), at::native::asin_out_sparse(), torch::jit::SimpleValue::attr(), torch::jit::Object::attr(), torch::jit::mobile::Module::attr(), torch::jit::ConcretePythonOp::autogradFunction(), at::native::baddbmm_cpu_kernel(), org.pytorch.torchvision.TensorImageUtils::bitmapToFloatBuffer(), at::native::bmm_out_or_baddbmm_(), c10::cuda::impl::c10_cuda_test(), C10_DEFINE_bool(), torch::jit::Canonicalize(), at::native::cat_sparse(), torch::jit::Module::clone_impl(), at::native::combinations(), torch::jit::tensorexpr::combineMultilane(), compute_2d(), compute_2d_tiled(), nom::nql::convertToNQLString(), caffe2::convertToVector(), at::vitals::TorchVital::create(), torch::jit::Graph::createClone(), c10::hip::OptionalHIPStreamGuardMasqueradingAsCUDA::current_stream(), c10::cuda::OptionalCUDAStreamGuard::current_stream(), c10::TensorOptions::device(), torch::jit::fuser::cpu::disas(), at::native::div_out_sparse_scalar(), at::native::div_out_sparse_zerodim(), div_rtn(), doPartialPythonIO(), doPartialPythonReadBuffered(), doRead(), doWrite(), c10::TensorOptions::dtype(), c10::dynamic_intrusive_pointer_cast(), torch::jit::CodeImpl::emitType(), torch::jit::EraseNumberTypesOnBlock(), torch::jit::ScriptTypeParser::evaluateDefaults(), c10::Type::expect(), c10::Type::expectRef(), torch::jit::extra_files_from_python(), torch::jit::factorial(), c10::filter(), torch::jit::Environment::findInAnyFrame(), torch::jit::MiniEnvironment< T >::findInAnyFrame(), at::native::floor_divide_out_sparse_scalar(), torch::jit::floordiv(), c10::fmap(), c10d::fmap(), torch::jit::gcd(), nom::nql::GraphMatcher::genMatcherFromASTGraph(), torch::jit::CompilationUnit::get_function(), c10::enforce_detail::EnforceFailMessage::get_message_and_free(), c10::ClassType::getAttributeSlot(), c10::ClassType::getConstantSlot(), torch::jit::tensorexpr::LoopNest::getLoopBodyFor(), torch::jit::GraphExecutorImpl::getOrCompile(), torch::jit::getTensorType(), torch::handle_torch_function(), at::native::hspmm_out_sparse_cpu(), at::native::hspmm_sparse_cpu(), torch::jit::initTreeViewBindings(), torch::jit::to_ir::insertRefinements(), torch::jit::RefinementSet::intersectSet(), c10::TensorOptions::layout(), torch::autograd::PyNode::legacy_apply(), torch::utils::legacy_tensor_ctor(), torch::utils::legacy_tensor_new(), torch::jit::Lexer::lex(), torch::jit::liftClosure(), torch::autograd::generated::details::linalg_qr_backward(), at::native::linspace_cpu_out(), at::native::log1p_out_sparse(), at::native::logspace_cpu_out(), torch::jit::loop(), torch::jit::materializeConstant(), at::native::matrix_power(), torch::jit::ParserImpl::maybeParseAssignmentOp(), c10::TensorOptions::memory_format(), c10::merge_primitive(), torch::autograd::generated::details::mm_mat2_backward(), torch::autograd::generated::details::mse_loss_double_backward_grad_output(), at::native::mul_out_sparse_cpu(), at::native::mul_out_sparse_scalar(), at::native::mul_out_sparse_zerodim(), torch::jit::tensorexpr::mulMultilane(), torch::jit::tensorexpr::IRMutator::mutate(), at::native::neg_out_sparse(), torch::utils::new_ones(), torch::utils::new_tensor(), torch::jit::tensorexpr::nnc_aten_conv2d(), torch::jit::tensorexpr::nnc_aten_matmul(), c10::hip::OptionalHIPStreamGuardMasqueradingAsCUDA::original_stream(), c10::cuda::OptionalCUDAStreamGuard::original_stream(), torch::nn::init::orthogonal_(), torch::autograd::utils::parse_to_conversion(), torch::jit::IRParser::parseAttr(), torch::jit::ParserImpl::parseBaseExp(), torch::jit::ParserImpl::parseFor(), torch::jit::ParserImpl::parseFormalParams(), torch::jit::ParserImpl::parseIf(), torch::jit::SchemaTypeParser::parseList(), torch::jit::ParserImpl::parseList(), torch::jit::IRParser::parseScalarLiteral(), torch::jit::ParserImpl::parseStatements(), torch::jit::SchemaTypeParser::parseType(), torch::jit::IRParser::parseVarWithType(), torch::jit::ParserImpl::parseWhile(), torch::jit::ParserImpl::parseWith(), c10::TensorOptions::pinned_memory(), c10::polar(), torch::jit::pop(), at::native::pow_out_sparse_scalar(), at::native::pow_sparse_scalar(), torch::data::DataLoaderBase< Dataset, Batch, BatchRequest >::prefetch(), at::native::prelu_cpu_kernel_share_weights(), torch::jit::Node::print(), at::native::quantize_val_arm(), at::native::range_cpu_out(), c10::cuda::CUDACachingAllocator::raw_alloc(), c10::cuda::CUDACachingAllocator::raw_alloc_with_stream(), c10::TensorOptions::requires_grad(), torch::jit::tensorexpr::LoopNest::rfactor(), rotl32(), rotl64(), torch::jit::fuser::cpu::runCompiler(), at::native::s_addmm_out_sparse_dense_cpu(), at::native::s_addmm_out_sparse_dense_worker(), at::native::s_addmm_sparse_dense_cpu(), at::CPUGeneratorImpl::set_state(), torch::jit::Node::setSourceRange(), torch::jit::shape_is_fast_for_reduce(), torch::jit::tensorexpr::simplifyRoundModPattern(), c10::size_between_dim_(), c10::size_from_dim_(), c10::size_to_dim_(), torch::autograd::generated::details::smooth_l1_loss_double_backward_grad_output(), torch::autograd::generated::details::soft_margin_loss_double_backward_grad_output(), torch::utils::sparse_coo_tensor_ctor(), at::native::sparse_mask_cpu(), at::native::sparse_mask_cuda(), at::native::sparse_mask_out_cpu(), at::native::sparse_mask_out_cuda(), at::native::sqrt_out_sparse(), at::native::sqrt_sparse(), c10::static_intrusive_pointer_cast(), torch::optim::LBFGS::step(), at::native::sub_out_sparse(), torch::autograd::generated::details::sum_exclude_dim1(), torch::utils::tensor_ctor(), torch::jit::tensorTypeInCurrentExecutionContext(), cpp_extension_test.TestConsumeOp::test_jit_consume_op(), cpp_extension_test.TestConsumeOp::test_jit_consume_op_for_list_input(), THCPEvent_from_ipc_handle(), THPDevice_pynew(), THPFInfo_pynew(), THPFunction_saved_variables(), THPGenerator_pynew(), THPIInfo_pynew(), torch::autograd::THPVariable__parse_to(), torch::autograd::THPVariable_arange(), THPVariable_as_subclass(), torch::autograd::THPVariable_bfloat16(), torch::autograd::THPVariable_bool(), torch::autograd::THPVariable_byte(), torch::autograd::THPVariable_char(), torch::autograd::THPVariable_contiguous(), torch::autograd::THPVariable_copy_(), torch::autograd::THPVariable_cpu(), torch::autograd::THPVariable_cuda(), torch::autograd::THPVariable_double(), torch::autograd::THPVariable_float(), torch::autograd::THPVariable_full(), torch::autograd::THPVariable_get_device(), THPVariable_get_volatile(), torch::autograd::THPVariable_half(), torch::autograd::THPVariable_int(), torch::autograd::THPVariable_is_contiguous(), torch::autograd::THPVariable_long(), THPVariable_make_subclass(), torch::autograd::THPVariable_map2_(), torch::autograd::THPVariable_map_(), torch::autograd::THPVariable_nonzero(), torch::autograd::THPVariable_pynew(), torch::autograd::THPVariable_randint(), torch::autograd::THPVariable_range(), torch::autograd::THPVariable_requires_grad_(), THPVariable_set_volatile(), torch::autograd::THPVariable_short(), torch::autograd::THPVariable_size(), torch::autograd::THPVariable_stride(), torch::autograd::THPVariable_to(), torch::autograd::THPVariable_type(), torch::autograd::THPVariable_xpu(), at::native::to_impl(), c10::IValue::toIntrusivePtr(), at::TensorGeometry::transpose(), c10::tryEvalTypeVariables(), torch::jit::tryMatchSchema(), torch::jit::tuple_tail(), torch::jit::RefinementSet::unionSet(), c10::raw::intrusive_ptr::use_count(), c10::raw::weak_intrusive_ptr::use_count(), torch::jit::to_ir::validateAssignLhsExpr(), torch::jit::InlinedCallStack::vec(), torch::jit::tensorexpr::LoopNest::vectorize(), torch::jit::tensorexpr::IRVisitor::visit(), c10::TensorType::withPossiblyUndefined(), c10::TensorType::withUndefined(), torch::autograd::utils::wrap(), and at::Tensor::wrap_tensor_impl().

◆ sl_

const int* sl_
private

Definition at line 318 of file boolean_mask_ops.cc.

◆ USE_OPERATOR_CONTEXT_FUNCTIONS

USE_OPERATOR_CONTEXT_FUNCTIONS

Definition at line 11 of file boolean_mask_ops.cc.