torch_mlu/csrc/aten/core/generator_impl.cpp
void MLUGeneratorImpl::update_state() {
  // update the state tensor.
  if (is_floating_device && state_need_reset_) {
    std::lock_guard<std::mutex> lock(mutex_);
    auto state_impl = getMluTensorImpl(state_);
    auto state_ptr = state_impl->cnnlMalloc();
    TORCH_CHECK(state_ptr, "the state point is nullptr, "
                           "please init state before calling its point");
    auto handle = getCurrentHandle();
    TORCH_CNNL_CHECK(cnnlRandMakeMTGP32KernelState(handle, state_ptr, nullptr, nullptr, seed_));
    state_need_reset_ = false;
  }
}
/**
 * update_state
 *
 * See Note [Acquire lock when using random generators]
  */
update_state
See Note [Acquire lock when using random generators]
update_state See Note [ Acquire lock when using random generators ]
void MLUGeneratorImpl::update_state() {
  if (is_floating_device && state_need_reset_) {
    std::lock_guard<std::mutex> lock(mutex_);
    auto state_impl = getMluTensorImpl(state_);
    auto state_ptr = state_impl->cnnlMalloc();
    TORCH_CHECK(state_ptr, "the state point is nullptr, "
                           "please init state before calling its point");
    auto handle = getCurrentHandle();
    TORCH_CNNL_CHECK(cnnlRandMakeMTGP32KernelState(handle, state_ptr, nullptr, nullptr, seed_));
    state_need_reset_ = false;
  }
}
void MLUGeneratorImpl :: update_state ( ) { if ( is_floating_device && state_need_reset_ ) { std :: lock_guard < std :: mutex > lock ( mutex_ ) ; auto state_impl = getMluTensorImpl ( state_ ) ; auto state_ptr = state_impl -> cnnlMalloc ( ) ; TORCH_CHECK ( state_ptr , " " " " ) ; auto handle = getCurrentHandle ( ) ; TORCH_CNNL_CHECK ( cnnlRandMakeMTGP32KernelState ( handle , state_ptr , nullptr , nullptr , seed_ ) ) ; state_need_reset_ = false ; } }
update_state
 See Note [Acquire lock when using random generators]
update_state See Note [ Acquire lock when using random generators ]
// update the state tensor.