class MXNet::Gluon::Constant

Overview

A constant parameter for holding immutable tensors.

Constants are ignored by Autograd and Trainer, thus their values will not change during training. But you can still update their values manually with the set_data method.

Defined in:

mxnet/gluon/parameter.cr

Constructors

Instance Method Summary

Instance methods inherited from class MXNet::Gluon::Parameter

==(other : self) ==, data(ctx = nil) data, dtype : Symbol? dtype, dtype=(dtype) dtype=, grad(ctx = nil) grad, init(init = nil, ctx = nil, default_init = :uniform, force_reinit = false) init, list_ctx list_ctx, list_data list_data, list_grad list_grad, name : String name, set_data(data) set_data, shape : Array(Int32)? shape, shape=(shape) shape=, to_s(io) to_s, trainer : MXNet::Gluon::Trainer? trainer, trainer=(trainer) trainer=, var var, zero_grad zero_grad

Constructor methods inherited from class MXNet::Gluon::Parameter

new(name, shape = nil, dtype = nil, init = nil, allow_deferred_init = false, grad_req = :write) new

Constructor Detail

def self.new(name, value) #

Creates a new instance.

Parameters

  • name (String, required) Name of the constant.
  • value (Array | NDArray, required) Initial value for the constant.

[View source]

Instance Method Detail

def to_s(io) #

Writes this object to an IO.


[View source]