Skip to content

gen_ops.left_shift method throws Exception #614

Closed

Description

@dje-dev

The following code snippet throws a NullReferenceException on the last line (running under Preview 4).

Previously this left_shift method worked great in version 0.15.1, I'm not sure if perhaps there is something more needed in my code for compatibility with TF Version 2 or if this represents a bug.

Thank you.

tf.enable_eager_execution();

using (var graph = tf.Graph())
{
  Tensor bits = tf.constant(new int[] { 0, 1}, dtype: tf.int64);
  Tensor ones = tf.ones(new TensorShape(new int[] { 2 }), TF_DataType.TF_INT64);
  Tensor bitMasks = Tensorflow.Operations.gen_ops.left_shift(ones, bits);
}

-------------------------------------------------
Tensorflow.Operation.implicit operator System.IntPtr(Tensorflow.Operation op) Line 31
Tensorflow.Tensor._as_tf_output() Line 205
Tensorflow.ops._create_c_op<object>(Tensorflow.Graph graph, Tensorflow.NodeDef node_def, object[] inputs, Tensorflow.Operation[] control_inputs)
Tensorflow.Operation.Operation(Tensorflow.NodeDef node_def, Tensorflow.Graph g, Tensorflow.Tensor[] inputs, Tensorflow.TF_DataType[] output_types, Tensorflow.ITensorOrOperation[] control_inputs, Tensorflow.TF_DataType[] input_types, string original_op, Tensorflow.OpDef op_def)
Tensorflow.Graph.create_op(string op_type, Tensorflow.Tensor[] inputs, Tensorflow.TF_DataType[] dtypes, Tensorflow.TF_DataType[] input_types, string name, System.Collections.Generic.Dictionary<string, Tensorflow.AttrValue> attrs, Tensorflow.OpDef op_def, bool compute_device)
Tensorflow.OpDefLibrary._apply_op_helper.AnonymousMethod__0(Tensorflow.ops.NameScope scope)
Tensorflow.Binding.tf_with<Tensorflow.ops.NameScope, Tensorflow.Operation>(Tensorflow.ops.NameScope py, System.Func<Tensorflow.ops.NameScope, Tensorflow.Operation> action)
Tensorflow.OpDefLibrary._apply_op_helper(string op_type_name, string name, System.Collections.Generic.Dictionary<string, object> keywords)
Tensorflow.Operations.gen_ops.left_shift(Tensorflow.Tensor x, Tensorflow.Tensor y, string name) Line 14611
TensorFlowBenchmark.Program.Main(string[] args) Line 18

Activity

  1. Oceania2018 commented on Sep 6, 2020

    @Oceania2018
    Member
    var lhs = tf.constant(new int[] { -1, -5, -3, -14 });
    var rhs = tf.constant(new int[] { 5, 0, 7, 11 });
    var left_shift_result = tf.bitwise.left_shift(lhs, rhs);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions