Browse Source

Update tf.js (#563)

Lutz Roeder 4 years ago
parent
commit
eb8710effb
1 changed files with 4 additions and 0 deletions
  1. 4 0
      source/tf.js

+ 4 - 0
source/tf.js

@@ -1225,6 +1225,10 @@ tf.Tensor = class {
                 case DataType.DT_UINT32:
                 case DataType.DT_INT64:
                 case DataType.DT_UINT64:
+                    if (!this._buffer || this._buffer.length === 0) {
+                        context.state = 'Tensor has content.';
+                        return context;
+                    }
                     context.rawData = new DataView(this._buffer.buffer, this._buffer.byteOffset, this._buffer.byteLength);
                     break;
             }