-
Descriptionconstructed simple model, but throw out dmlc error Error Message
To Reproducerun the minimal code example Steps to reproduce
import mxnet as mx
bn_mom = 0.9
emb_size=512
def get_fc1(last_conv, num_classes, fc_type, input_channel=512):
body = last_conv
if fc_type == 'E':
body = mx.sym.BatchNorm(data=body, fix_gamma=False, eps=2e-5, momentum=0.9, name='bn1')
body = mx.symbol.Dropout(data=body, p=0.4)
# output of backbone
fc1 = mx.sym.FullyConnected(data=body, num_hidden=num_classes, name='pre_fc1')
fc1 = mx.sym.BatchNorm(data=fc1, fix_gamma=True, eps=2e-5, momentum=0.9, name='fc1')
##################### add 3 tasks #####################################
fcAA_weight = mx.sym.Variable("pre_fcAA_weight", lr_mult=10, shape=(num_classes, emb_size))
fcAA = mx.sym.FullyConnected(data=body, weight=fcAA_weight, num_hidden=num_classes, name='pre_fcAA', no_bias=True)
fcAA = mx.sym.BatchNorm(data=fcAA, fix_gamma=True, eps=2e-5, momentum=0.9, name='fcAA')
fcBBder_weight = mx.sym.Variable("pre_fcBB_weight", lr_mult=10, shape=(num_classes, emb_size))
fcBBder = mx.sym.FullyConnected(data=body, weight=fcBBder_weight, num_hidden=num_classes, name='pre_fcBB', no_bias=True)
fcBBder = mx.sym.BatchNorm(data=fcBBder, fix_gamma=True, eps=2e-5, momentum=bn_mom, name='fcBB')
fcCCe_weight = mx.sym.Variable("pre_fcCC_weight", lr_mult=10, shape=(num_classes, emb_size))
fcCCe = mx.sym.FullyConnected(data=body, weight=fcCCe_weight, num_hidden=num_classes, name='pre_fcCC', no_bias=True)
fcCCe = mx.sym.BatchNorm(data=fcCCe, fix_gamma=True, eps=2e-5, momentum=bn_mom, name='fcCC')
print('Added 3 tasks')
##################### add 3 tasks #####################################
print('Net built.')
return mx.sym.Group([fc1, fcAA, fcBBder, fcCCe])
if __name__ == '__main__':
from mxnet import nd
import numpy as np
v_input = nd.random.normal(0, 1, shape=(3, 4))
sym_input = mx.symbol.Variable('sym_input', shape=nd.empty((3,4)))
c = get_fc1(last_conv=sym_input, num_classes=512, fc_type='E', input_channel=512)
grad = mx.symbol.BlockGrad()
loss = mx.sym.MakeLoss(grad+sym_input)
exe = loss.simple_bind(ctx=mx.cpu(2), sym_input=v_input) What have you tried to solve it?
Environment
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Welcome to Apache MXNet (incubating)! We are on a mission to democratize AI, and we are glad that you are contributing to it by opening this issue. |
Beta Was this translation helpful? Give feedback.
-
@Light--
|
Beta Was this translation helpful? Give feedback.
@Light--
simple_bind
takes the shape (not the data) of a symbol variable. The correct usage isSee
Symbol.simple_bind