Code Monkey home page Code Monkey logo

din_tf_eager's People

Contributors

jangmino avatar

Watchers

 avatar  avatar

din_tf_eager's Issues

tf version? sigmoid_cross_entropy_with_logits expects int32 but not float tensor

Hi jangmino,

which TF version you are using?
When I train you model, this happens.
do you have any idea about this error?

def loss(inputs, labels):
    print(labels.dtype)
    logits = model(inputs, training=True)
    print(logits.dtype)
    return tf.reduce_mean(
      tf.nn.sigmoid_cross_entropy_with_logits(
        logits=logits,
        labels=labels)
    )

val_grad_fn = tfe.implicit_value_and_gradients(loss)
Elapsed total 19.62031316757202 : model 4.2279510498046875
<dtype: 'int32'>
<dtype: 'float32'>
Traceback (most recent call last):
  File "model.py", line 384, in <module>
    tf.app.run(main=main, argv=[sys.argv[0]] + unparsed)
  File "/home/ubuntu/hdd1/zip_data/Paul/miniconda3/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 125, in run
    _sys.exit(main(argv))
  File "model.py", line 335, in main
    train_one_epoch(epoch_i=i, train_data=ds_train, log_interval=FLAGS.log_interval, **model_objects)
  File "model.py", line 264, in train_one_epoch
    value, grads_and_vars = val_grad_fn((u, i, i_c, ts, hist_c, sl), y)
  File "/home/ubuntu/hdd1/zip_data/Paul/miniconda3/lib/python3.6/site-packages/tensorflow/python/eager/backprop.py", line 203, in grad_fn
    end_node = f(*args, **kwds)
  File "model.py", line 249, in loss
    labels=labels)
  File "/home/ubuntu/hdd1/zip_data/Paul/miniconda3/lib/python3.6/site-packages/tensorflow/python/ops/nn_impl.py", line 181, in sigmoid_cross_entropy_with_logits
    relu_logits - logits * labels,
  File "/home/ubuntu/hdd1/zip_data/Paul/miniconda3/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py", line 850, in binary_op_wrapper
    return func(x, y, name=name)
  File "/home/ubuntu/hdd1/zip_data/Paul/miniconda3/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py", line 1094, in _mul_dispatch
    return gen_math_ops.mul(x, y, name=name)
  File "/home/ubuntu/hdd1/zip_data/Paul/miniconda3/lib/python3.6/site-packages/tensorflow/python/ops/gen_math_ops.py", line 4959, in mul
    _six.raise_from(_core._status_to_exception(e.code, message), None)
  File "<string>", line 3, in raise_from
tensorflow.python.framework.errors_impl.InvalidArgumentError: cannot compute Mul as input #0 was expected to be a int32 tensor but is a float tensor [Op:Mul] name: logistic_loss/mul/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.