Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike-Leo-Smith committed Dec 6, 2023
1 parent 2c12995 commit 21be15c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/base/integrator.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ class DifferentiableIntegrator : public Integrator {
};

private:
luisa::unique_ptr<Loss> _loss;
luisa::unique_ptr<Optimizer> _optimizer;
const Loss *_loss;
const Optimizer *_optimizer;
uint _iterations;
int _display_camera_index;
bool _save_process;
Expand All @@ -122,8 +122,8 @@ class DifferentiableIntegrator : public Integrator {
DifferentiableIntegrator(Scene *scene, const SceneNodeDesc *desc) noexcept;

[[nodiscard]] bool is_differentiable() const noexcept override { return true; }
[[nodiscard]] auto loss() const noexcept { return _loss.get(); }
[[nodiscard]] auto optimizer() const noexcept { return _optimizer.get(); }
[[nodiscard]] auto loss() const noexcept { return _loss; }
[[nodiscard]] auto optimizer() const noexcept { return _optimizer; }
[[nodiscard]] auto iterations() const noexcept { return _iterations; }
[[nodiscard]] int display_camera_index() const noexcept { return _display_camera_index; }
[[nodiscard]] bool save_process() const noexcept { return _save_process; }
Expand Down
5 changes: 2 additions & 3 deletions src/textures/constant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ class ConstantTextureInstance final : public Texture::Instance {
CommandBuffer &cmd_buffer,
luisa::optional<Differentiation::ConstantParameter> param) noexcept
: Texture::Instance{p, t}, _diff_param{std::move(param)} {
LUISA_INFO("index {} prepared.", _diff_param->index());
if (!t->should_inline()) {
auto [buffer, buffer_id] = p.allocate_constant_slot();
auto v = t->v();
Expand Down Expand Up @@ -104,8 +103,8 @@ class ConstantTextureInstance final : public Texture::Instance {
Expr<float>, Expr<float4> grad) const noexcept override {
if (_diff_param) {
$if(_diff_param->index() != 0u) {
device_log("ggggggggg ({}) , grad in accumulate: ({}, {}, {})",
_diff_param->index(), grad[0u], grad[1u], grad[2u]);
// device_log("ggggggggg ({}) , grad in accumulate: ({}, {}, {})",
// _diff_param->index(), grad[0u], grad[1u], grad[2u]);
};
auto slot_seed = xxhash32(as<uint3>(it.p()));
// $if(_diff_param->index() == 1u) {
Expand Down

0 comments on commit 21be15c

Please sign in to comment.