Coder Social home page Coder Social logo

deeplearningwithtensorflow's People

Contributors

sethjuarez avatar

Watchers

 avatar  avatar  avatar

deeplearningwithtensorflow's Issues

ValueError: Attempt to convert a value (220) with an unsupported type (<class 'numpy.int32'>) to a Tensor.

Hi Seth,

I'm trying to setup your demo (as seen on Techorama) but am running into an issue I'm not able to figure out:

When I try to run the squares.ipynb it fails in the 3rd block:
image

The actual error message:

ValueError                                Traceback (most recent call last)
<ipython-input-3-fd2d05abe21c> in <module>
      4 def convert(x, y): return tf.dtypes.cast(x, tf.float32)/255., tf.one_hot(y, depth=3)
      5 
----> 6 train_ds = tf.data.Dataset.from_tensor_slices(generate(60000))
      7 train_ds = train_ds.map(convert)
      8 train_ds = train_ds.shuffle(buffer_size=1000)

C:\ProgramData\Miniconda3\envs\tf2\lib\site-packages\tensorflow_core\python\data\ops\dataset_ops.py in from_tensor_slices(tensors)
    433       Dataset: A `Dataset`.
    434     """
--> 435     return TensorSliceDataset(tensors)
    436 
    437   class _GeneratorState(object):

C:\ProgramData\Miniconda3\envs\tf2\lib\site-packages\tensorflow_core\python\data\ops\dataset_ops.py in __init__(self, element)
   2352   def __init__(self, element):
   2353     """See `Dataset.from_tensor_slices()` for details."""
-> 2354     element = structure.normalize_element(element)
   2355     batched_spec = structure.type_spec_from_value(element)
   2356     self._tensors = structure.to_batched_tensor_list(batched_spec, element)

C:\ProgramData\Miniconda3\envs\tf2\lib\site-packages\tensorflow_core\python\data\util\structure.py in normalize_element(element)
    109         else:
    110           normalized_components.append(
--> 111               ops.convert_to_tensor(t, name="component_%d" % i))
    112   return nest.pack_sequence_as(element, normalized_components)
    113 

C:\ProgramData\Miniconda3\envs\tf2\lib\site-packages\tensorflow_core\python\framework\ops.py in convert_to_tensor(value, dtype, name, preferred_dtype, dtype_hint)
   1182   preferred_dtype = deprecation.deprecated_argument_lookup(
   1183       "dtype_hint", dtype_hint, "preferred_dtype", preferred_dtype)
-> 1184   return convert_to_tensor_v2(value, dtype, preferred_dtype, name)
   1185 
   1186 

C:\ProgramData\Miniconda3\envs\tf2\lib\site-packages\tensorflow_core\python\framework\ops.py in convert_to_tensor_v2(value, dtype, dtype_hint, name)
   1240       name=name,
   1241       preferred_dtype=dtype_hint,
-> 1242       as_ref=False)
   1243 
   1244 

C:\ProgramData\Miniconda3\envs\tf2\lib\site-packages\tensorflow_core\python\framework\ops.py in internal_convert_to_tensor(value, dtype, name, as_ref, preferred_dtype, ctx, accept_composite_tensors)
   1294 
   1295     if ret is None:
-> 1296       ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
   1297 
   1298     if ret is NotImplemented:

C:\ProgramData\Miniconda3\envs\tf2\lib\site-packages\tensorflow_core\python\framework\tensor_conversion_registry.py in _default_conversion_function(***failed resolving arguments***)
     50 def _default_conversion_function(value, dtype, name, as_ref):
     51   del as_ref  # Unused.
---> 52   return constant_op.constant(value, dtype, name=name)
     53 
     54 

C:\ProgramData\Miniconda3\envs\tf2\lib\site-packages\tensorflow_core\python\framework\constant_op.py in constant(value, dtype, shape, name)
    225   """
    226   return _constant_impl(value, dtype, shape, name, verify_shape=False,
--> 227                         allow_broadcast=True)
    228 
    229 

C:\ProgramData\Miniconda3\envs\tf2\lib\site-packages\tensorflow_core\python\framework\constant_op.py in _constant_impl(value, dtype, shape, name, verify_shape, allow_broadcast)
    233   ctx = context.context()
    234   if ctx.executing_eagerly():
--> 235     t = convert_to_eager_tensor(value, ctx, dtype)
    236     if shape is None:
    237       return t

C:\ProgramData\Miniconda3\envs\tf2\lib\site-packages\tensorflow_core\python\framework\constant_op.py in convert_to_eager_tensor(value, ctx, dtype)
     94       dtype = dtypes.as_dtype(dtype).as_datatype_enum
     95   ctx.ensure_initialized()
---> 96   return ops.EagerTensor(value, ctx.device_name, dtype)
     97 
     98 

ValueError: Attempt to convert a value (220) with an unsupported type (<class 'numpy.int32'>) to a Tensor.

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.