Module: TensorStream::Images

Extended by:
OpHelper, Utils
Defined in:
lib/tensor_stream/images.rb

Class Method Summary collapse

Methods included from OpHelper

_op, cons, format_source, fp_type?, i_cons, i_op, i_var, int_type?, reduced_shape, shape_eval, shape_full_specified, shapes_fully_specified_and_equal

Methods included from Utils

__v_scope_name, apply_data_type_coercion, assign, check_allowed_types, check_data_types, check_if_dense, colocate_with, constant, control_dependencies, convert_to_tensor, device, disable_eager_execution, dynamic_stitch, enable_eager_execution, executing_eagerly?, float32, get_collection, get_default_graph, get_variable, get_variable_scope, global_variables_initializer, graph, group, image, layers, list_local_devices, math, name_scope, placeholder, program, reset_default_graph, session, set_random_seed, train, trainable_variables, variable, variable_scope

Class Method Details

.decode_jpeg(contents, channels: 0, dtype: :uint8, name: nil, new_shape: nil) ⇒ Object



10
11
12
# File 'lib/tensor_stream/images.rb', line 10

def self.decode_jpeg(contents, channels: 0, dtype: :uint8, name: nil, new_shape: nil)
  _op(:decode_jpg, contents, channels: channels, data_type: dtype, name: name, new_shape: new_shape)
end

.decode_png(contents, channels: 0, dtype: :uint8, name: nil, new_shape: nil) ⇒ Object



6
7
8
# File 'lib/tensor_stream/images.rb', line 6

def self.decode_png(contents, channels: 0, dtype: :uint8, name: nil, new_shape: nil)
  _op(:decode_png, contents, channels: channels, data_type: dtype, name: name, new_shape: new_shape)
end

.encode_png(contents, compression: -1,, name: nil, new_shape: nil, resample_method: nil) ⇒ Object



14
15
16
17
18
# File 'lib/tensor_stream/images.rb', line 14

def self.encode_png(contents, compression: -1, name: nil, new_shape: nil, resample_method: nil)
  check_allowed_types(contents, %i[uint8 uint16])
  contents = convert_to_tensor(contents, dtype: :uint16)
  _op(:encode_png, contents, compression: compression, name: name, new_shape: new_shape, resample_method: resample_method)
end